I am a mediocre docker user and since today I am baffled by a command which makes a mess of the docker host service. Context: I am running various docker containers with traefik as reverse proxy and I am planning to run openvpn as vpn server in this setup, using the image kylemanna/openvpn.
Using ansible I need to check if a server conf is already available or not. The problem is
docker run --rm kylemanna/openvpn ls /etc/openvpn/openvpn.conf keeps the container alive, I don’t get the terminal back and killing the container in a secondary session just makes things worse. I am not sure if this is because of something in the image used or that it’s something in docker-ce:
me@server:~$ docker run -v openvpn-data:/etc/openvpn --rm kylemanna/openvpn ls /etc/openvpn/openvpn.conf ls: /etc/openvpn/openvpn.conf: No such file or directory [ now I don't get any prompt back.... ]
In another session:
me@server:~$ docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f23db27b6184 kylemanna/openvpn "ls /etc/openvpn/pki" 10 hours ago Up 10 hours 1194/udp confident_chebyshev 8027cd41fe77 kylemanna/openvpn "ls /etc/openvpn/ope…" 12 hours ago Up 12 hours 1194/udp tender_saha 3f8fa70c4912 kylemanna/openvpn "ovpn_initpki" 12 hours ago Up 12 hours 1194/udp flamboyant_torvalds 49f2314af137 traefik:2.1 "/entrypoint.sh trae…" 10 days ago Up 22 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp traefik me@server:~$ docker container stop confident_chebyshev Connection to example.com closed by remote host. Connection to example.com closed. me@workstation:~$ ssh server Last login: Thu Feb 27 18:01:20 2020 from 220.127.116.11 me@server:~$ docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? me@server:~$ sudo reboot now [sudo] password for me: Connection to example.com closed by remote host. Connection to example.com closed. me@workstation:~$ ssh server Last login: Thu Feb 27 18:03:16 2020 from 18.104.22.168 me@server:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES bed95f29d521 kylemanna/openvpn "ovpn_run --proto udp" 11 hours ago Restarting (1) 10 seconds ago ovpn-udp 49f2314af137 traefik:2.1 "/entrypoint.sh trae…" 10 days ago Up 49 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp traefik
A few things which look odd to me:
-I don’t get a prompt back when performing
ls in the container
-docker can’t stop the container, it kills it after 10 (or so) seconds
-when killing, my ssh session is lost. Sshd runs on the host, not inside a container
-when going back, docker seems not running, a reboot solves the problem
-if there are more kylemanna/openvpn containers stale, all of them are gone after reboot
What is going on here? Is this because of something in the openvpn image, did I hit a problem with docker or should I execute the command differently? Any help is greatly appreciated!
Some more info on the system:
me@server:~$ docker --version Docker version 19.03.6, build 369ce74a3c me@server:~$ uname --al Linux server 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux