Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Container port mapping only work once per restart
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
davidshen84
Guru
Guru


Joined: 09 Aug 2008
Posts: 314

PostPosted: Sun Oct 21, 2018 10:29 am    Post subject: Container port mapping only work once per restart Reply with quote

Hi,

My system info.

    Gentoo 64 bit
    Docker version 18.03.1-ce, build 9ee9f40
    After I installed and started the docker service, I was able to launch the nginx container and access the welcome page.


Code:
docker run --rm -p 80:80 nginx:latest


But after I killed the container, and re-launch it with the same command, the container can start, but I cannot access the welcome page at http://localhost:80. I also found the browser did not say the connection was refused, instead, it just waits forever.

If I restart the docker service, I was able to create a new nginx container and access the welcome page. But, if I kill the container, the same issue re-occurs.

It feels like the port mapping function only works once.

Thanks,
D.
_________________
David Shen
Back to top
View user's profile Send private message
davidshen84
Guru
Guru


Joined: 09 Aug 2008
Posts: 314

PostPosted: Tue Oct 23, 2018 7:41 am    Post subject: Reply with quote

Nobody uses docker on Gentoo, or I posted in the wrong section?
_________________
David Shen
Back to top
View user's profile Send private message
forrestfunk81
Guru
Guru


Joined: 07 Feb 2006
Posts: 565
Location: münchen.de

PostPosted: Mon Oct 29, 2018 4:06 pm    Post subject: Reply with quote

I stumbled upon the same problem some time ago. But usually I declare the exposed ports within a Dockerfile and build the container manually. Changing the ports works with this approach.
_________________
# cd /pub/
# more beer
Back to top
View user's profile Send private message
guitou
Guru
Guru


Joined: 02 Oct 2003
Posts: 534
Location: France

PostPosted: Wed Oct 31, 2018 12:42 pm    Post subject: Reply with quote

Hello.

I might be completely wrong, but I suppose running the container sets up a "network", while stopping the container does not remove this same network, thus leaving port 80 busy (mapping to an obsolete container).

EDIT: If I am not wrong, then maybe simply running the following command might help:
Code:
docker network prune


++
Gi)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum