Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker containers keep losing internet

Tags:

docker

I have configured to use docker on Centos 6.5. Quite often the containers keep losing internet. In such instances I have to restart Docker on the host. Recently, I tried to run an yum update from inside a container which failed. Following is the log from /var/log/docker

2014/07/15 10:33:36 GET /v1.12/containers/update_test/json
[b601ba8c] +job container_inspect(update_test)
[b601ba8c] -job container_inspect(update_test) = OK (0)
2014/07/15 10:33:36 POST /v1.12/containers/update_test/attach?stderr=1&stdin=1&stdout=1&stream=1
[b601ba8c] +job container_inspect(update_test)
2014/07/15 10:33:36 POST /v1.12/containers/update_test/start
[b601ba8c] +job start(update_test)
[b601ba8c] -job container_inspect(update_test) = OK (0)
[b601ba8c] +job attach(update_test)
[b601ba8c] +job allocate_interface(5a5c0247441ef5872b531ba720ba1f7d8af2df1cbd47b4a98b84a7b995384d8b)
[b601ba8c] -job allocate_interface(5a5c0247441ef5872b531ba720ba1f7d8af2df1cbd47b4a98b84a7b995384d8b) = OK (0)
[b601ba8c] -job start(update_test) = OK (0)
2014/07/15 10:33:36 POST /v1.12/containers/update_test/resize?h=37&w=165
[b601ba8c] +job resize(update_test, 37, 165)
[b601ba8c] -job resize(update_test, 37, 165) = OK (0)
[b601ba8c] +job release_interface(5a5c0247441ef5872b531ba720ba1f7d8af2df1cbd47b4a98b84a7b995384d8b)
[b601ba8c] -job release_interface(5a5c0247441ef5872b531ba720ba1f7d8af2df1cbd47b4a98b84a7b995384d8b) = OK (0)
[error] container.go:492 5a5c0247441ef5872b531ba720ba1f7d8af2df1cbd47b4a98b84a7b995384d8b: Error closing terminal: invalid argument
[b601ba8c] -job attach(update_test) = OK (0)

As mentioned above restarting Docker on the host solves the issue. I don't want to keep restarting the docker as I am planning to run a production application through docker. Anybody have any idea in this regard?

Please let me know if you need more information in this regard.

like image 594
Maduraiveeran Avatar asked Jul 15 '14 09:07

Maduraiveeran


2 Answers

It is my bad that I did not mention that the host was hosted in the Rackspace. My apologies for not clarifying that (at that time I thought that it was irrelevant). It was the Rackspace's automated routine that kept messing up the iptables which obviously affected the docker routing. Rackspace did suggest to create a lock file somewhere in the /etc to prevent their automated routine touching the iptables which I have forgotten now; should not be difficult for anybody to get this from them if they experience the issue.

like image 124
Maduraiveeran Avatar answered Nov 15 '22 12:11

Maduraiveeran


As suggested by Maduraiveeran, to prevent Rackspace from overwriting Docker's custom iptables rules you need to create a lock file in /etc. The file should be named rackconnect-allow-custom-iptables:

touch /etc/rackconnect-allow-custom-iptables

Once the lockfile has been created, restart your docker daemon with: sudo systemctl restart docker

https://support.rackspace.com/how-to/how-to-prevent-rackconnect-from-overwriting-custom-iptables-rules-on-linux-cloud-servers/

like image 39
Charlie Lee Avatar answered Nov 15 '22 10:11

Charlie Lee