-
Notifications
You must be signed in to change notification settings - Fork 18.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker restart a container will change the port mapping #8723
Comments
@cc272309126 1.3.0-dev would be master. |
@cpuguy83 on 1.3.0 after restart the container the mapping port still changed, After I read the code, I found that restarting the container will allocate the mapping port again unless allocating a port for container manual. so I think maybe that's designing. and the mapping port lost has been fixed. |
I'm running into issues due to this behavior: I'm running a lot of containers on the hosts and sometimes (e.g. due to provisioning runs) the docker daemon is restarted. After this, all port mappings are different. |
@hcguersoy do you specify a host port mapping to a container port like "docker run -d -p 1234:1234 image command"? |
Hi, sorry for my late answer... No, I don't. But I would expect that a restarted container uses the same ports again. |
I have also been hit by this bug, and it's a deployment blocker for me. Although in production one will want to use fixed port mappings, there are scenarios (development, testing, staging) where you want containers to survive a daemon/host reboot and keep their port mapping, if not just to not destroy the work-flow of all involved people that are still using the containers. |
I have implemented stateful hostconfig save/restore in my docker-fw utility, feel free to give it a shot. |
closing as dup of #7158 which is why it gets another port |
also #9047 for reference |
Hi,
after docker restart containerid,it will allocate a new port to the container,Is there a way hold the port for a container?or this is feature for docker?
reproduce steps
1,docker run -d -p 8080 imageid
2,docker restart containerid
3,compare the container the mapping port,you will found that the port is changed。
ps: on docker 1.2.0 after restart the container twice,the port will lost. but this issue can not be reproduced on docker docker-1.3.0-dev.
thanks
The text was updated successfully, but these errors were encountered: