Gitlab CI runner not able to expose ports of nested Docker containers

前端 未结 4 1190
不知归路
不知归路 2020-12-15 17:28

When using GitLab CI, as well as the gitlab-ci-multi-runner, I\'m unable to get internally-started Docker containers to expose their ports to the \"host\", whic

4条回答
  •  别那么骄傲
    2020-12-15 18:03

    Your docker-compose.yml seems to be ok.

    But I think there is error with your ip or port routing. As I can see from your shared info your app is running on port 9143 on ip 0.0.0.0 as 0.0.0.0:9143.

    and you are accessing it as localhost:9143, which can be interpreted as 127.0.0.1:9143.

    According to this.

    127.0.0.1 is the loopback address (also known as localhost).
    0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown, or non-applicable target (a ‘no particular address’ place holder).
    

    Can you try to run your app on 127.0.0.1:9143 then share the result.

    UPDATE

    or you can use service to run it by service name as documentation suggest:

    The services keyword defines just another docker image that is run during your build and is linked to the docker image that the image keyword defines. This allows you to access the service image during build time.

    The service container for MySQL will be accessible under the hostname mysql. So, in order to access your database service you have to connect to the host named mysql instead of a socket or localhost.

提交回复
热议问题