Skip to content

[Bug]: Running on gitlab CI does not work as host.docker.internal is not available #5517

@kicktipp

Description

@kicktipp

Module

Core

Testcontainers version

1.17.2

Using the latest Testcontainers version?

Yes

Docker version

Docker version 20.10.17, build 100c701

What happened?

The docs for gitlab CI show a wrong config.toml. On linux the host.docker.internal is not reachable.

Test ist with

ping:
  stage: test
  script: apt update; apt install -y iputils-ping; ping -c1 host.docker.internal

The result is:

...
Setting up iputils-ping (3:20210202-1) ...
ping: host.docker.internal: Name or service not known
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1
...

I found some information about host.docker.internal on linux machines:
https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66

I added extra_hosts=["host.docker.internal:host-gateway"] to my config.toml and no the server is reachable

The documentation should add this.

Relevant log output

Setting up iputils-ping (3:20210202-1) ...
ping: host.docker.internal: Name or service not known
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions