Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

Docker Swarm: how to update published post

I use the Play-with-Docker platform to create a Swarm cluster with 3 Docker instances: 1 manager and 2 workers; then I create a service from the image nginx:alpine:

docker service create -p 8080:80 --name nginx-app nginx:alpine

Things worked fine.

Then I update the service to change the published port: instead of 8080, now I want the published port to be 8081. I ran this:

docker service update --publish-rm 8080 --publish-add 8081 nginx-app

But it did not remove the published port 8080; instead it created another published port 30002, this port 30002 mapped to 8081

enter image description here

What did I do wrong here? How can I change the published port?

question from:https://stackoverflow.com/questions/65929883/docker-swarm-how-to-update-published-post

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Remove those services and start it like this instead:

docker service create -p 8081:80 --name nginx-app nginx:alpine


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...