1

I'm trying to apply a demo like in the article :

Scale ASP.NET Core Apps with Docker Swarm Mode

Unfortunately after creating and start the service on docker swarm , I couldn't access the api http://localhost:5000/api/token . However, when I call the api in the running container (using docker exec) or creating the service using host mode every thing goes OK.

Note : I'm trying using docker desktop in my local machine , so I enabled swarm mode using the following command

docker swarm init --advertise-addr 192.168.56.1 

where 192.168.56.1 is the VirtualBox ip

Edit : Corresponding container:

enter image description here

Service port configuration:

enter image description here

thanks in advance .

Shadi
  • 191
  • 3
  • 13
  • Is this docker desktop using toolbox and `docker-machine`? – BMitch Jul 23 '20 at 17:55
  • thanks for your response @BMitch , I don't thinks so,when I'm trying , 'docker-machine' command , Im getting it is not recognized as an internal or external command. – Shadi Jul 23 '20 at 20:15
  • In that case I'm confused by the VirtualBox reference since that was last used with `docker-machine`. Current versions of Docker for Win and Mac use hyperv and xhyve under the covers and you shouldn't be seeing the IP of the Docker VM in VirtualBox. – BMitch Jul 23 '20 at 20:19
  • Screenshots are rather illegible, and remove the ability for others to search on your question. Please post as code formatted text instead. – BMitch Jul 23 '20 at 20:21

1 Answers1

0

Could you provide the output of docker ps command, my guess is that something has not been done correctly with the following command.

docker service create --publish 5000:5000 --name tokengen tokengen-img
Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52
Sreekanth
  • 13
  • 4
  • Thanks for response , I edited the question to add it – Shadi Jul 23 '20 at 14:58
  • Under the ports section, it is blank, which effectively means the publishing did not work. Also I see the target port as 80 and published port as 5000, which does not sit well with the `--publish 5000:5000`. So maybe the service create was not run correctly or did not create the required service. – Sreekanth Jul 24 '20 at 15:28
  • thanks again @Sreekanth , in fact I published it using --publish 5000:80 , and inside the container it works normally – Shadi Jul 27 '20 at 08:05