Skip to content

TODO: add a dev note regarding sudoless docker #749

Closed

Description

@Tranquility2

Devs should be informed (using the official docs) that the testing environment considers sudoless docker as a baseline (and some things might not work / break if sudo is required)

For a future plan, we should rewrite / avoid using docker command directly (for example using subprocess.run) and use the docker SDK.

Activity

  1. Tranquility2 commented on Dec 14, 2024

    @Tranquility2
    ContributorAuthor

    Image
    This is the general gist

  2. Tranquility2 commented on Dec 14, 2024

    @Tranquility2
    ContributorAuthor

    @alexanderankin @totallyzen please tell me how you think is best to proceed and I'll open a PR accordingly.

  3. alexanderankin commented on Dec 15, 2024

    @alexanderankin
    Member

    what did you do that didnt work? for example, i just pulled latest main, ran tests with make tests, expected that to work and it did. Well, I'm still waiting - currently it is running aws, core/arango succeeded.

  4. Tranquility2 commented on Dec 15, 2024

    @Tranquility2
    ContributorAuthor

    Checkout the comments on https://github.com/testcontainers/testcontainers-python/pull/714/files#r1885389659
    TLDR: the dind tests fails as they run "docker build" without sudo using subprocess.

  5. Tranquility2 commented on Dec 15, 2024

    @Tranquility2
    ContributorAuthor

    I assume you prefer not to add this comment so I'll start working on replacing the relevant code.

  6. alexanderankin commented on Dec 15, 2024

    @alexanderankin
    Member

    ah okay so "sudoless" refers not to rootless docker or anything but rather it refers to the permissions on the docker socket.

    I consider it invalid docker installation if you do not also do

    sudo usermod -aG docker $USER
    

    after installing.

    I wonder what the difference is between using DockerClient() - as I've instructed people to do the usermod and that has unblocked people using testcontainers in general before on linux (via slack).

  7. Tranquility2 commented on Dec 15, 2024

    @Tranquility2
    ContributorAuthor

    Note that its not the user that affect the behavior but the complimentary requirement
    export DOCKER_HOST=unix:///run/user/1000/docker.sock source
    This can be avoided as the DockerClient fetch the DOCKER_HOST and make our life easier without the need to rely on/in case docker is running with/without sudo :)

  8. added a commit that references this issue on Dec 15, 2024
    ace2a7d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions