docker service create with port definition doesn't really cut it
When you run a typically docker service create, it might not worked as expected when it comes to publishing port.
Unfortunately this does not happen in docker-compose and docker stack deploy too.
Normally this is how you would create your service. As you might already know, we create a service , add configs and publish port 5003 (host machine) to 80 (container)
Yet this might not work.
docker service create --name myapp --config src=appsettings,target=c:\settings\settings.yml -p 5003:80 -e SETTINGS.SHAREDPATH=c:\settings myapp:image-0297
To force this
docker service create --name myapp --config src=appsettings,target=c:\settings\settings.yml -p mode=host,target=80,published=5003 -e SETTINGS.SHAREDPATH=c:\settings myapp:image-0297
Comments