Skip to content

Testcontainer does not detect custom docker sock location #5047

Closed

Description

@vishnuramvs29

I have docker environment configured using Lima.

limactl start docker.yaml

Followed by docker run hello-world

works good and sample docker container is working good.

To make Testcontainer to point to new docker location, I added the following config to testcontainer.properties

docker.client.strategy=org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy
docker.host=unix:///Users/user/.lima/docker/sock/docker.sock

I also added the above config to /Users/user/.testcontainer.properties as well.

Once I start the container, I get the below logs

09:46:56.354 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:[/Users/venkavis/Desktop/new_github/nimble-notification-service/target/test-classes/testcontainers.properties]()
09:46:56.357 [main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy from [~/.testcontainers.properties](), will try it first
09:46:56.656 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
09:46:56.678 [ducttape-0] DEBUG org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:

The log says it successfully loaded configuration from testcontainer.properties file but actually its running org.testcontainers.dockerclient.DockerClientProviderStrategy instead of org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy.

Can someone help me what config I am missing here? Or the logs are shown wrongly?

Activity

  1. bsideup commented on Feb 15, 2022

    @bsideup
    Member

    From the logs:

    Loaded org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy from ~/.testcontainers.properties, will try it first

    DockerClientProviderStrategy is the log category. Also, what you experience with limactl start is Docker Context - this is Docker CLI's feature that Testcontainers knowns nothing about because it does not use Docker CLI.

    See more info here:
    #5039 (comment)

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