Skip to content

[Bug]: docker.host parameter doesn't work anymore #1338

@also1366

Description

@also1366

Testcontainers version

0.21.0

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host arch

x86

Go version

1.20

Docker version

Server: Docker Engine - Community
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:17 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
 rootlesskit:
  Version:          1.1.0
  ApiVersion:       1.1.1
  NetworkDriver:    slirp4netns
  PortDriver:       builtin
  StateDir:         /tmp/rootlesskit1968203600
 slirp4netns:
  Version:          1.0.1
  GitCommit:        6a7b16babc95b6a3056b33fb45b74a6f62262dd4

Docker info

Client: Docker Engine - Community
 Version:    24.0.2
 Context:    rootless
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.5
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.18.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 12
  Running: 9
  Paused: 0
  Stopped: 3
 Images: 444
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: false
  userxattr: true
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
 runc version: v1.1.7-0-g860f061
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  rootless
  cgroupns
 Kernel Version: 6.1.0-0.deb11.7-amd64
 Operating System: Debian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 30.96GiB
 Name: hamlet
 ID: OHFM:AHIA:VZBD:46XM:4WBY:HAF5:7A4F:LWAD:YKMU:FZ3O:XZXO:YHCX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: whoisxmlapi
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

What happened?

I have a .testcontainers.properties file in my home directory:
docker.host=unix:///var/run/user/1000/docker.sock

The library reads the docker host and strips "unix://" part.
Then it provides the host "/var/run/user/1000/docker.sock" to the docker library.
Though the docker library expects the host to start with "unix://" and throws an error.

It works fine for me in version 0.20.1

When I run the test with the env variable DOCKER_HOST=unix:///var/run/user/1000/docker.sock it works.
It doesn't strip "unix://".

I read this PR that behaviour somewhat changed, but I don't understand what's happening.
#1161

Am I doing something wrong?

Relevant log output

=== RUN   TestContainers/TestElasticsearch
Testcontainers properties file has been found: /home/user/.testcontainers.properties
    main_test.go:37: failed to start container: unable to parse docker host `/var/run/user/1000/docker.sock`, failed to create Docker provider

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue with the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions