Search code examples
dockerasp.net-coredockerfileazure-container-service

Deploy ASP.NET core to Azure Container Service (Swarm mode)


I've set up an Azure Container Service cluster, as shown here https://learn.microsoft.com/en-us/azure/container-service/container-service-deployment with SWARM. Then I've connect to it as shown here https://learn.microsoft.com/en-us/azure/container-service/container-service-connect.

I've installed docker for windows (I've shared drives) and the visual studio docker tools.

I've created the default ASP.NET Core app that has this dockerfile

FROM microsoft/aspnetcore:1.0.1
ENTRYPOINT ["dotnet", "MyTest.dll"]
ARG source=.
WORKDIR /app
EXPOSE 80
COPY $source .

I've changed it (because it doesn't do anything) to something that looks like :

FROM microsoft/aspnetcore:1.0.1
WORKDIR /app
EXPOSE 80
COPY out ./
ENTRYPOINT ["dotnet", "MyTest.dll"]

Then, I've opened a command prompt and moved to my root folder and i've done :

set DOCKER_HOST = tcp://localhost:2375
docker version

(docker version is OK)

then :

dotnet publish -c Release -o out
docker build -t testaspnetcore .

then :

docker run -d -p 8080:80 testaspnetcore 

then :

docker ps

and I see the container in the list, but when I connect to my cluster ACS with SSH and I do

docker -H 172.16.0.5:2375 ps -a

I can't see my container in the cluster.

note : when I do docker ps on local, i can see in putty event log : Forwarded port closed due to local error: Network error: Software caused connection abort. Tried to turn of firewall, and many others things, but no results

How can I deploy to the swarm cluster my own image ?


Solution

  • There is a tutorial at https://learn.microsoft.com/en-us/azure/container-service/container-service-docker-swarm

    With respect to your Putty problem it might me that you have Docker running on your client machine thus you have a port conflict. You can change the client port to something different to avoid this clash.