Consegui que isso funcionasse desativando o ufw.
$ sudo ufw disable
Há certamente uma maneira melhor, se você conhece um, por favor poste aqui.
Estou começando com o docker e decidi ativar minha instância do gitlab em um contêiner e gitlab-ci-multi-runner para realizar meus builds de CI (apenas para testar as possibilidades do fluxo).
Girar a instância do gitlab é bastante simples usando o sameersbn / docker-gitlab no github.
O problema surge quando tento executar o gitlab-ci-multi-runner, que precisa se autorizar com o gitlab através da rede de contêineres inter no host.
Então, tento girar o contêiner do corredor com docker-compose up
com o seguinte 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
(Eu tentei mudar a porta para 80 aqui, mas o mesmo resultado)
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)
Durante a execução deste contêiner, recebo:
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
Eu posso ver no wireshark que os pacotes estão indo para o gitlab, mas ele não responde com nada:
Euprecisomencionarqueogitlabfuncionasemnenhumproblemaeeupossoacessá-lodomeuhost.
ufw
temoencaminhamentoativado:
cat/etc/default/ufw#/etc/default/ufw##SettoyestoapplyrulestosupportIPv6(nomeansonlyIPv6onloopback#accepted).Youwillneedto'disable'andthen'enable'thefirewallfor#thechangestotakeaffect.IPV6=yes#SetthedefaultinputpolicytoACCEPT,DROP,orREJECT.Pleasenotethatif#youchangethisyouwillmostlikelywanttoadjustyourrules.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"
O mais frustrante é que consegui que funcionasse ontem, mas agora estou confuso porque não mudei nada.
Arquivos contêineres do Gitlab: link
Consegui que isso funcionasse desativando o ufw.
$ sudo ufw disable
Há certamente uma maneira melhor, se você conhece um, por favor poste aqui.