Docker Community Forums

Share and learn in the Docker community.

Ubuntu container and OpenVPN client


(Nurza) #1

Hello, i’m using CoreOS (522.6.0) to build a cluster running OpenVPN client.

Each container is using ubuntu:latest

I run a container with the privileged and device option to use the tun device to use Openvpn:

sudo docker run -P --name rs1_srv30 -d dev24/mongodb --replSet rs2 --noprealloc --smallfiles --privileged --device /dev/net/tun

When i press ENTER, it displays a hash and when i run docker ps -a:

CONTAINER ID        IMAGE                  COMMAND                CREATED             STATUS                        PORTS               NAMES
4063aab1da0f        dev24/mongodb:latest   "usr/bin/mongod --re   33 seconds ago      Exited (1) 32 seconds ago                         rs1_srv30

The journalctl:

Feb 03 17:00:08 coreos-db sudo[5156]: root : TTY=pts/0 ; PWD=/home/core/docker_mongodb_cluster ; USER=root ; COMMAND=/bin/docker run -P --name rs1_srv30 -d dev24/mongodb --replSet rs2 --nopr
Feb 03 17:00:08 coreos-db docker[699]: [info] POST /v1.15/containers/create?name=rs1_srv30
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job create(rs1_srv30)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job log(create, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job log(create, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest) = OK (0)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job create(rs1_srv30) = OK (0)
Feb 03 17:00:08 coreos-db docker[699]: [info] POST /v1.15/containers/4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4/start
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job start(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job allocate_interface(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job allocate_interface(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4) = OK (0)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job log(start, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job log(start, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest) = OK (0)
Feb 03 17:00:08 coreos-db systemd[1]: Starting docker container 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4.
Feb 03 17:00:08 coreos-db systemd[1]: Started docker container 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4.
Feb 03 17:00:08 coreos-db kernel: device veth9a6902b entered promiscuous mode
Feb 03 17:00:08 coreos-db systemd-networkd[612]: vethc8215eb     : link configured
Feb 03 17:00:08 coreos-db kernel: IPv6: ADDRCONF(NETDEV_UP): vethc8215eb: link is not ready
Feb 03 17:00:08 coreos-db kernel: IPv6: ADDRCONF(NETDEV_CHANGE): vethc8215eb: link becomes ready
Feb 03 17:00:08 coreos-db systemd-networkd[612]: vethc8215eb     : gained carrier
Feb 03 17:00:08 coreos-db systemd-networkd[612]: veth9a6902b     : link configured
Feb 03 17:00:08 coreos-db systemd-networkd[612]: vethc8215eb     : lost carrier
Feb 03 17:00:08 coreos-db kernel: eth0: renamed from vethc8215eb
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job start(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4) = OK (0)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job log(die, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job log(die, 4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4, dev24/mongodb:latest) = OK (0)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] +job release_interface(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4)
Feb 03 17:00:08 coreos-db docker[699]: [274ec265] -job release_interface(4063aab1da0f330518c54054a6efc093aa6235b3993eed9baa7e7ae782af12e4) = OK (0)
Feb 03 17:00:08 coreos-db kernel: docker0: port 8(veth9a6902b) entered disabled state
Feb 03 17:00:08 coreos-db kernel: device veth9a6902b left promiscuous mode
Feb 03 17:00:08 coreos-db kernel: docker0: port 8(veth9a6902b) entered disabled state
Feb 03 17:00:08 coreos-db systemd-networkd[612]: veth9a6902b     : could not find udev device
Feb 03 17:00:41 coreos-db docker[699]: [info] GET /v1.15/containers/json?all=1
Feb 03 17:00:41 coreos-db docker[699]: [274ec265] +job containers()
Feb 03 17:00:41 coreos-db docker[699]: [274ec265] -job containers() = OK (0)
Feb 03 17:00:43 coreos-db systemd[1]: Starting Generate /run/coreos/motd...
Feb 03 17:00:43 coreos-db systemd[1]: Starting OpenSSH per-connection server daemon (62.210.129.215:60487)...
Feb 03 17:00:43 coreos-db systemd[1]: Started OpenSSH per-connection server daemon (62.210.129.215:60487).
Feb 03 17:00:43 coreos-db systemd[1]: Started Generate /run/coreos/motd.
Feb 03 17:00:43 coreos-db sshd[5184]: Failed password for root from 62.210.129.215 port 60487 ssh2
Feb 03 17:00:43 coreos-db sshd[5184]: Received disconnect from 62.210.129.215: 11: Bye Bye [preauth]
Feb 03 17:00:48 coreos-db systemd[1]: Starting OpenSSH per-connection server daemon (62.210.129.215:40375)...
Feb 03 17:00:48 coreos-db systemd[1]: Started OpenSSH per-connection server daemon (62.210.129.215:40375).
Feb 03 17:00:48 coreos-db sshd[5195]: Failed password for root from 62.210.129.215 port 40375 ssh2
Feb 03 17:00:48 coreos-db sshd[5195]: Received disconnect from 62.210.129.215: 11: Bye Bye [preauth]

How do you do to run OpenVPN client on a docker container please?


(Sven Dowideit) #2

I suspect it has less to do with openvpn, and more to do with your command -

what happens if you start that container running bash and then start mongod with the same options from there? does it keep running in the foreground?