Devices are not passed into docker container
Hi :) I am trying to get a test configuration working, in which I need to get run a docker image, which accesses to a company VPN using OpenVPN. When I run my image directly in docker, all works fine:
$ docker run --name unv --device /dev/net/tun -d --cap-add=NET_ADMIN actifsource/ubuntu-node-vpn
Then I added this image as a runner with following configuration, using the information from you documentation :
[[runners]]
name = "ci runner 3 on actifsource.cloud:/src/gitlab-runner"
url = "######"
token = "4a61223a285########428b183d68d"
tls-ca-file = ""
executor = "docker"
[runners.docker]
image = "actifsource/ubuntu-node-vpn"
cap_add = ["NET_ADMIN"]
extra_hosts = ["selenium.actifsource.cloud:10.8.0.1"]
devices = ["/dev/net/tun"]
privileged = false
volumes = ["/cache"]
The image seems to be run, but from OpenVPN client I now get the following error:
Wed Mar 16 11:43:41 2016 ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Wed Mar 16 11:43:41 2016 Exiting due to fatal error
ERROR: Build failed with: exit code 1
This is the same error message I get, when I do not pass the --device - Flag to my first run:
$ docker run --name unv --cap-add=NET_ADMIN actifsource/ubuntu-node-vpn
Wed Mar 16 12:01:25 2016 OpenVPN 2.3.2 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [eurephia] [MH] [IPv6] built on Feb 4 2014
######
Wed Mar 16 12:01:28 2016 ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Wed Mar 16 12:01:28 2016 Exiting due to fatal error
To me it seems as if the device flag is not passed to the docker run command... I am fairly new to this, so maybe I just made a stupid mistake?
Thank you very much for any help. Michael
Not sure, whether these information from docker inspect can help:
$ docker inspect runner-4a65223e-project-2-concurrent-0-cache-fd9e15c6010b97ac6ffaaf5e3df31a34
[
{
"Id": "9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127",
"Created": "2016-03-16T11:27:37.023329398Z",
"Path": "/entrypoint",
"Args": [
"/builds/cloud"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-03-16T11:27:37.618804657Z",
"FinishedAt": "2016-03-16T11:27:37.673551055Z"
},
"Image": "sha256:046501f04ed2cc6d8c60a9e70cdd7537fc77a66d95faf19918a291b73b81de15",
"ResolvConfPath": "/var/lib/docker/containers/9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127/hostname",
"HostsPath": "/var/lib/docker/containers/9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127/hosts",
"LogPath": "/var/lib/docker/containers/9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127/9869fc0b3baf3a663a985eb1f2f67e7b13eddd828683835362428f018c404127-json.log",
"Name": "/runner-4a65223e-project-2-concurrent-0-cache-fd9e15c6010b97ac6ffaaf5e3df31a34",
"RestartCount": 0,
"Driver": "aufs",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": null,
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"ShmSize": 67108864,
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"KernelMemory": 0,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null
},
"GraphDriver": {
"Name": "aufs",
"Data": null
},
"Mounts": [
{
"Name": "81e8d93245a121682a1f18c6d35d5e362ab6ec9e1759186aec4c11b4944e9565",
"Source": "/var/lib/docker/volumes/81e8d93245a121682a1f18c6d35d5e362ab6ec9e1759186aec4c11b4944e9565/_data",
"Destination": "/builds/cloud",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "9869fc0b3baf",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/builds/cloud"
],
"Image": "sha256:046501f04ed2cc6d8c60a9e70cdd7537fc77a66d95faf19918a291b73b81de15",
"Volumes": {
"/builds/cloud": {}
},
"WorkingDir": "",
"Entrypoint": [
"/entrypoint"
],
"OnBuild": null,
"Labels": {
"com.gitlab.gitlab-runner.build.before_sha": "0000000000000000000000000000000000000000",
"com.gitlab.gitlab-runner.build.id": "43",
"com.gitlab.gitlab-runner.build.ref_name": "master",
"com.gitlab.gitlab-runner.build.sha": "dba1f1166ded79ab3f05914a96cda956aaf20ed6",
"com.gitlab.gitlab-runner.cache.dir": "/builds/cloud",
"com.gitlab.gitlab-runner.project.id": "2",
"com.gitlab.gitlab-runner.runner.global_id": "0",
"com.gitlab.gitlab-runner.runner.id": "4a65223e",
"com.gitlab.gitlab-runner.runner.local_id": "0",
"com.gitlab.gitlab-runner.type": "cache"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "######",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": null,
"SandboxKey": "/var/run/docker/netns/######",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "######",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": ""
}
}
}
}
]