0

I am starting with docker and I have decided to spin up my gitlab instance in a container as well as gitlab-ci-multi-runner to perform my CI builts (just to test the possibilities of the flow).

Spinning up gitlab instance is pretty straightforward using sameersbn/docker-gitlab on github.

The problem arises when I try to run gitlab-ci-multi-runner which needs to authorize itself with gitlab through inter container network on the host.

So I try to spin up the runner container with docker-compose up with the following docker-compose.yml:

GitlabCIMultiRunner:
  image: sameersbn/gitlab-ci-multi-runner:0.5.5
  external_links:
    - dockergitlab_gitlab_1
    - dockergitlab_redis_1
    - dockergitlab_postgresql_1
  volumes:
    - /opt/gitlab-ci-multi-runner:/home/gitlab_ci_multi_runner/data
  environment:
    - CI_SERVER_URL=http://172.17.42.1:10080/ci
    - RUNNER_TOKEN=7004aa61f9b54fff738c
    - RUNNER_DESCRIPTION=first_runner2
    - RUNNER_EXECUTOR=shell
  restart: always

( I have tried changing port to 80 here but the same result)


ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:67:fb:25:f0  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:67ff:fefb:25f0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:75897 errors:0 dropped:0 overruns:0 frame:0
          TX packets:76897 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:6044672 (6.0 MB)  TX bytes:182094199 (182.0 MB)

eth1      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet6 addr: fe80::76d4:35ff:febf:e59b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:157786 errors:0 dropped:0 overruns:0 frame:0
          TX packets:91095 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:228008432 (228.0 MB)  TX bytes:7527000 (7.5 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:27113 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27113 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1492710 (1.4 MB)  TX bytes:1492710 (1.4 MB)

lxcbr0    Link encap:Ethernet  HWaddr ba:8b:63:fc:b4:74  
          inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::b88b:63ff:fefc:b474/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:133 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:23031 (23.0 KB)

veth0e49f88 Link encap:Ethernet  HWaddr 22:74:21:72:0f:aa  
          inet6 addr: fe80::2074:21ff:fe72:faa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:986 (986.0 B)  TX bytes:5191 (5.1 KB)

veth665256b Link encap:Ethernet  HWaddr b6:fa:d0:ba:87:f1  
          inet6 addr: fe80::b4fa:d0ff:feba:87f1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:346 errors:0 dropped:0 overruns:0 frame:0
          TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:281005 (281.0 KB)  TX bytes:96373 (96.3 KB)

veth907894c Link encap:Ethernet  HWaddr be:ba:12:22:67:92  
          inet6 addr: fe80::bcba:12ff:fe22:6792/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:653 errors:0 dropped:0 overruns:0 frame:0
          TX packets:643 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:50409 (50.4 KB)  TX bytes:170680 (170.6 KB)

vethd4d2b56 Link encap:Ethernet  HWaddr d2:ea:76:1a:63:51  
          inet6 addr: fe80::d0ea:76ff:fe1a:6351/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1017 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1077 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:272555 (272.5 KB)  TX bytes:344684 (344.6 KB)

While running this container I would get:

docker-compose up
Creating dockergitlabcimultirunner_GitlabCIMultiRunner_1...
Attaching to dockergitlabcimultirunner_GitlabCIMultiRunner_1
GitlabCIMultiRunner_1 | time="2015-09-26T20:35:08Z" level=error msg="Couldn't execute POST against http://172.17.42.1:10080/ci/api/v1/runners/register.json: Post http://172.17.42.1:10080/ci/api/v1/runners/register.json: dial tcp 172.17.42.1:10080: i/o timeout" 
GitlabCIMultiRunner_1 | time="2015-09-26T20:35:08Z" level=error msg="7004aa61 Registering runner... failed" 
GitlabCIMultiRunner_1 | time="2015-09-26T20:35:08Z" level=fatal msg="Failed to register this runner. Perhaps you are having network problems" 
dockergitlabcimultirunner_GitlabCIMultiRunner_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
Stopping dockergitlabcimultirunner_GitlabCIMultiRunner_1... done

I can see in wireshark that packets are going to gitlab but it doesn't reply with anything:

enter image description here

I need to mention that gitlab works without any problems and I can access it from my host.

ufw has forwarding enabled:

cat /etc/default/ufw
# /etc/default/ufw
#

# Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
# accepted). You will need to 'disable' and then 'enable' the firewall for
# the changes to take affect.
IPV6=yes

# Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_INPUT_POLICY="DROP"

# Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_OUTPUT_POLICY="ACCEPT"

# Set the default forward policy to ACCEPT, DROP or REJECT.  Please note that
# if you change this you will most likely want to adjust your rules
DEFAULT_FORWARD_POLICY="ACCEPT"

What's most frustrating is that I got that to work yesterday but now I am confused as I have not changed anything.

Gitlab's container files: https://github.com/sameersbn/docker-gitlab

1 Answer 1

0

I managed to get that to work by disabling ufw.

$ sudo ufw disable

There certainly is a better way if you know one please post it here.

3
  • I'm in a similar situation (ref askubuntu.com/questions/1164430), Patryk, were your ufw in active stage or inactive before you disabled it?
    – xpt
    Aug 9, 2019 at 14:20
  • @xpt sorry but there is no way for me to check it now after 4 years now :(
    – Patryk
    Aug 9, 2019 at 16:34
  • Oh, no worry then. Thanks a lot for getting back to me. Cheers.
    – xpt
    Aug 10, 2019 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .