Skip to content

[Feature]: Allow the container working directory to be specified #1900

@fhke

Description

@fhke

Problem

There is presently no way to set the working directory for the launched container. This complicates, and in some cases prevents, the use of relative paths in the container.

Solution

Add a new string type field WorkingDir to the ContainerRequest struct, and use this field to set the WorkingDir field in the Docker Config struct when creating a container.

Benefit

Users of testcontainers can operate on relative paths, and work in an isolated directory, without setting the working directory inside the container.

Alternatives

Depending on the use case users may be able to set the current working directory inside the process, either using the cd shell builtin or native language constructs.

Would you like to help contributing this feature?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality or new behaviors on the existing one

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions