Skip to content

Error when connecting to docker-rootless socket via tcp #57

Description

@vf-jes

When running testcontainers in GitLab CI with dind-rootless service, it does not work when connecting via tcp.

It works with dind (rootful):

.gitlab-ci.yml:

test:
  stage: test
  image: php:8.3-cli
  services:
    - docker:29-dind
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""

Doesn't work with dind-rootless (Exact same setup works with testcontainers-dotnet)

.gitlab-ci.yml:

test:
  stage: test
  image: php:8.3-cli
  services:
    - docker:29-dind-rootless
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
    TESTCONTAINERS_RYUK_DISABLED: true

This is the error:
1) Exception in third-party event subscriber: Cannot read the response
#0 /builds/group/project/vendor/php-http/socket-client/src/Client.php(85): Http\Client\Socket\Client->readResponse()
#1 /builds/group/project/vendor/php-http/client-common/src/HttpClientDecorator.php(28): Http\Client\Socket\Client->sendRequest()

It works when binding the dind docker socket though:

.gitlab-ci.yml:

test-php:
  stage: test
  image: php:8.3-cli
  services:
    - name: docker:29-dind-rootless
  variables:
    DOCKER_HOST: "unix:///runner/services/docker/docker.sock"
    TESTCONTAINERS_RYUK_DISABLED: true
    TESTCONTAINERS_HOST_OVERRIDE: docker

In /etc/gitlab-runner/config.toml
volumes = ["/runner/services/docker", "/cache"]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions