I'm trying to setup GitLab in my local machine and install GitLab and GitLab Runner in Docker:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f041339388c2 gitlab/gitlab-runner:latest "/usr/bin/dumb-init …" 19 minutes ago Up 19 minutes gitlab-runner
c3a1e9b99f38 gitlab/gitlab-ce:latest "/assets/wrapper" 46 hours ago Up About an hour (healthy) 0.0.0.0:22->22/tcp, :::22->22/tcp, 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp gitlab
Container inspect for gitlab
:
[
{
"Id": "c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb",
"Created": "2022-04-05T21:19:13.902999235Z",
"Path": "/assets/wrapper",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 1533,
"ExitCode": 0,
"Error": "",
"StartedAt": "2022-04-07T17:53:01.529265764Z",
"FinishedAt": "2022-04-06T21:58:58.315886026Z",
"Health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2022-04-08T06:51:09.70727281+12:00",
"End": "2022-04-08T06:51:09.879538644+12:00",
"ExitCode": 0,
"Output": "OUTPUT PATH"
},
{
"Start": "2022-04-08T06:52:09.883781229+12:00",
"End": "2022-04-08T06:52:10.007407598+12:00",
"ExitCode": 0,
"Output": "OUTPUT PATH"
},
{
"Start": "2022-04-08T06:53:10.012089806+12:00",
"End": "2022-04-08T06:53:10.123264724+12:00",
"ExitCode": 0,
"Output": "OUTPUT PATH"
},
{
"Start": "2022-04-08T06:54:10.12809284+12:00",
"End": "2022-04-08T06:54:10.273646619+12:00",
"ExitCode": 0,
"Output": "OUTPUT PATH"
},
{
"Start": "2022-04-08T06:55:10.279143578+12:00",
"End": "2022-04-08T06:55:10.399512189+12:00",
"ExitCode": 0,
"Output": "OUTPUT PATH"
}
]
}
},
"Image": "sha256:9c00b5927bae442d3f8902f5c3bb58acb849fb1969d4ce85eb1699b3618729b8",
"ResolvConfPath": "/var/lib/docker/containers/c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb/hostname",
"HostsPath": "/var/lib/docker/containers/c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb/hosts",
"LogPath": "/var/lib/docker/containers/c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb/c3a1e9b99f383031c2ab60d55d5b51b6081cb14cd99eaffbfd59f13b283261fb-json.log",
"Name": "/gitlab",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/srv/gitlab/config:/etc/gitlab",
"/srv/gitlab/logs:/var/log/gitlab",
"/srv/gitlab/data:/var/opt/gitlab"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"22/tcp": [
{
"HostIp": "",
"HostPort": "22"
}
],
"443/tcp": [
{
"HostIp": "",
"HostPort": "443"
}
],
"80/tcp": [
{
"HostIp": "",
"HostPort": "80"
}
]
},
"RestartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 268435456,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/4b28b6be75c79e41a90500a09d4493634e5fe95a1cdf38883c5bf3ad03c8ee02-init/diff:/var/lib/docker/overlay2/2b3bc79dfce88dc46d755ac2a57da59518b3c42e9143d81b42cf504079c5d9c9/diff:/var/lib/docker/overlay2/af25bc18d7ad1bca032219d6ed91de5c5c1eb585f59be7cdbdd6f87d9bfccb7c/diff:/var/lib/docker/overlay2/9b057ce4d478064a7ad4cc7b82819412b6353adf09b5564951b38f5bd17bcb87/diff:/var/lib/docker/overlay2/b6028dcc6d0b368ff1491e7d81a12a90eef1f68ea825543919b4b5fd7f3ad68b/diff:/var/lib/docker/overlay2/52ad6a00a274686a676a3c2f7c51e230fd3de77b9018dd9af9f73c26e143c547/diff:/var/lib/docker/overlay2/21fa78d0cf6e3b07a8b846b7b6e625c8a674f6f3b94e06c17532587c9174e622/diff:/var/lib/docker/overlay2/2dddf7eb7d91e36c86c873ad2577dab5ce095251f976995ca5d750595c9761fd/diff:/var/lib/docker/overlay2/6e52ab5f9066fe6d20c1985af0d505315977355ef34b3962142fd3cd665d0591/diff",
"MergedDir": "/var/lib/docker/overlay2/4b28b6be75c79e41a90500a09d4493634e5fe95a1cdf38883c5bf3ad03c8ee02/merged",
"UpperDir": "/var/lib/docker/overlay2/4b28b6be75c79e41a90500a09d4493634e5fe95a1cdf38883c5bf3ad03c8ee02/diff",
"WorkDir": "/var/lib/docker/overlay2/4b28b6be75c79e41a90500a09d4493634e5fe95a1cdf38883c5bf3ad03c8ee02/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/srv/gitlab/config",
"Destination": "/etc/gitlab",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/srv/gitlab/logs",
"Destination": "/var/log/gitlab",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/srv/gitlab/data",
"Destination": "/var/opt/gitlab",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "gitlab.example.com",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"22/tcp": {},
"443/tcp": {},
"80/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/opt/gitlab/embedded/bin:/opt/gitlab/bin:/assets:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=C.UTF-8",
"EDITOR=/bin/vi",
"TERM=xterm"
],
"Cmd": [
"/assets/wrapper"
],
"Healthcheck": {
"Test": [
"CMD-SHELL",
"/opt/gitlab/bin/gitlab-healthcheck --fail --max-time 10"
],
"Interval": 60000000000,
"Timeout": 30000000000,
"Retries": 5
},
"Image": "gitlab/gitlab-ce:latest",
"Volumes": {
"/etc/gitlab": {},
"/var/log/gitlab": {},
"/var/opt/gitlab": {}
},
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "57128e6ffed42d70c4979dd5021f063d8426c5f95ae4f5f60791f302b991d455",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"22/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "22"
},
{
"HostIp": "::",
"HostPort": "22"
}
],
"443/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "443"
},
{
"HostIp": "::",
"HostPort": "443"
}
],
"80/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "80"
},
{
"HostIp": "::",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/57128e6ffed4",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "5304f85f8b4fcf9e4b6e3febeef987e89cc71338132b7624e44d7e3e6f7466dc",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:03",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "9de2792fcb1439008ecc6412483f657c2d958f20c681782525f209e12f4c2dc3",
"EndpointID": "5304f85f8b4fcf9e4b6e3febeef987e89cc71338132b7624e44d7e3e6f7466dc",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:03",
"DriverOpts": null
},
"gitlab-network": {
"IPAMConfig": {},
"Links": null,
"Aliases": [
"c3a1e9b99f38",
"gitlab.example.com"
],
"NetworkID": "91536b80663973f3e96ea988a398763627d8678b90897c9c2af2234e4850f568",
"EndpointID": "2b53bcd1b619c68d69fb9bcab8db3ab763c3808ed3a466b378e1a4323f76cb48",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:03",
"DriverOpts": {}
}
}
}
}
]
Container inspect for gitlab-runner
:
[
{
"Id": "f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8",
"Created": "2022-04-07T18:33:41.706840368Z",
"Path": "/usr/bin/dumb-init",
"Args": [
"/entrypoint",
"run",
"--user=gitlab-runner",
"--working-directory=/home/gitlab-runner"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 11086,
"ExitCode": 0,
"Error": "",
"StartedAt": "2022-04-07T18:33:41.971920584Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:9b9fc292da4ab1898e96ebccba7b70d28996c7ba97782743ceb6508253856fb7",
"ResolvConfPath": "/var/lib/docker/containers/f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8/hostname",
"HostsPath": "/var/lib/docker/containers/f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8/hosts",
"LogPath": "/var/lib/docker/containers/f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8/f041339388c240b147ee82658dbe33feca8f73d556d208ac8aca303199895ed8-json.log",
"Name": "/gitlab-runner",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/srv/gitlab-runner/config:/etc/gitlab-runner",
"/var/run/docker.sock:/var/run/docker.sock"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "gitlab-network",
"PortBindings": {},
"RestartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/962a04960331a5d6282b9f5a673184560d5d668183137a373e3671346dc5a764-init/diff:/var/lib/docker/overlay2/1ed4db10a6e68c0c4fc9f902d1dcd74a94a4b6d26a159df5214256ea605a1c7e/diff:/var/lib/docker/overlay2/c2d172e960e7aca15c2564e86302418b14838cf976b74d11312281327e0dd437/diff:/var/lib/docker/overlay2/6e52ab5f9066fe6d20c1985af0d505315977355ef34b3962142fd3cd665d0591/diff",
"MergedDir": "/var/lib/docker/overlay2/962a04960331a5d6282b9f5a673184560d5d668183137a373e3671346dc5a764/merged",
"UpperDir": "/var/lib/docker/overlay2/962a04960331a5d6282b9f5a673184560d5d668183137a373e3671346dc5a764/diff",
"WorkDir": "/var/lib/docker/overlay2/962a04960331a5d6282b9f5a673184560d5d668183137a373e3671346dc5a764/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "volume",
"Name": "83f4f2d800709ce627753a2e086f965e40b8bf51bbc85fab91ddfc98f8e4f31e",
"Source": "/var/lib/docker/volumes/83f4f2d800709ce627753a2e086f965e40b8bf51bbc85fab91ddfc98f8e4f31e/_data",
"Destination": "/home/gitlab-runner",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
},
{
"Type": "bind",
"Source": "/srv/gitlab-runner/config",
"Destination": "/etc/gitlab-runner",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/var/run/docker.sock",
"Destination": "/var/run/docker.sock",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "f041339388c2",
"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": [
"run",
"--user=gitlab-runner",
"--working-directory=/home/gitlab-runner"
],
"Image": "gitlab/gitlab-runner:latest",
"Volumes": {
"/etc/gitlab-runner": {},
"/home/gitlab-runner": {}
},
"WorkingDir": "",
"Entrypoint": [
"/usr/bin/dumb-init",
"/entrypoint"
],
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGQUIT"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "ca7e0de2c2cc29fa673eb196bedca2b44d23e5f86d7f7ed6cde27593c8b0272e",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/ca7e0de2c2cc",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"gitlab-network": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"f041339388c2"
],
"NetworkID": "91536b80663973f3e96ea988a398763627d8678b90897c9c2af2234e4850f568",
"EndpointID": "7943e697deb3890b39afd71175ca8c7df92e96e5952d725f64b7475c15c12025",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}
]
From host machine I'm able to access gitlab
using http://172.18.0.3/ and the only part which is left is registering the gitlab-runner
but while I'm doing this part I'm getting I/O timeout error
$ sudo docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \
> --non-interactive \
> --executor "docker" \
> --docker-image alpine:latest \
> --url "http://172.18.0.3/" \
> --registration-token "GR1348941z4tNrqhtAWm2-HTNzqPd" \
> --description "docker-runner" \
> --maintenance-note "Free-form maintainer notes about this runner" \
> --tag-list "docker,aws" \
> --run-untagged="true" \
> --locked="false" \
> --access-level="not_protected"
Runtime platform arch=amd64 os=linux pid=7 revision=bd40e3da version=14.9.1
Running in system-mode.
ERROR: Registering runner... failed runner=GR134894 status=couldn't execute POST against http://172.18.0.3/api/v4/runners: Post "http://172.18.0.3/api/v4/runners": dial tcp 172.18.0.3:80: i/o timeout
PANIC: Failed to register the runner.
Docker containers started separately cannot communicate with each other unless their networks are explicitly linked. That is why you are getting an I/O error from your runner container.
To address this issue, either attach both containers to the same docker network (docker-compose makes this easy) or use host networking (
--network=host
) when running both containers and use localhost as the GitLab URL and registration target.Additional reference:
links:
,aliases:
andnetworks:
)