Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.
I can't figure out how to get testcontainers to find my docker executable. I can't find a way to tell it where docker is or set up a test environment that helps testcontainers to know where docker is.
I even created a symlink to docker in the folder, but subprocess can't find it.
I can't find a way to customize testcontainers. what am I missing?
To Reproduce
from testcontainers.compose import DockerCompose
async def test__can_run():
compose = DockerCompose(
compose_folder, compose_file_name='docker-compose.yml', env_file=str(Path(__file__).parents[1] / 'testing.env')
)
with compose:
assert True
> raise child_exception_type(errno_num, err_msg, err_filename)
E FileNotFoundError: [Errno 2] No such file or directory: 'docker'
../../../../.pyenv/versions/3.11.9/lib/python3.11/subprocess.py:1955: FileNotFoundError
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of testcontainers-python you are using? You can run the following commands to get the relevant information.
$ uname -a
Darwin WS-J26MXKQ4KP.tld 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 arm64
# Get the python version.
Python 3.11.9
# Get the docker version and other docker information.
docker client: 27.3.1
docker compose: 2.29.7
Describe the bug
I can't figure out how to get testcontainers to find my
docker
executable. I can't find a way to tell it wheredocker
is or set up a test environment that helps testcontainers to know wheredocker
is.I even created a symlink to docker in the folder, but subprocess can't find it.
I can't find a way to customize testcontainers. what am I missing?
To Reproduce
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of
testcontainers-python
you are using? You can run the following commands to get the relevant information.Installed packages
Things I've tried
produces:
Produces: