Reputation: 1101
I have a docker container which is running with port mapping.
cce2ca6eb83b nginx "nginx -g 'daemon off" 5 seconds ago Up 3 seconds 0.0.0.0:80->80/tcp www-nginx
Now I want to change host port from 80 to 8080. How can I do that?
docker update
does not have any option to change the network settings.
Upvotes: 1
Views: 2922
Reputation: 4777
You can't edit the port mapping for running container. docker update
command is used to prevent containers from consuming too many resources from their Docker host and also to dynamically set restart policy but not port mapping.
A work around for what you want to achieve could be to create a new image from your current container and then start a new container from the newly created image with the port 8080 as follow:
docker stop www-nginx
docker commit www-nginx www-nginx-2
docker run -p 8080:80 -td www-nginx-2
Upvotes: 4
Reputation: 38485
You can't edit the port mapping on a container, you will have to create a new container.
Upvotes: 1