I am launching docker inside another docker container and I'm trying to make files visible inside "deepest" container.
My first container is build on python:3.8-slim
image, entrypoint is ["python"]
and is called test-client
.
I launch it as docker run --rm -it -v /home/.../inputs:/inputs -v /var/run/docker.sock:/var/run/docker.sock --network ... test-client start_client.py ...
.
Now inner container.
Inside start_client.py
I run it with docker==5.0.3
library.
def check_docker():
import time
inputs = Mount('/inputs', 'inputs')
client = docker.from_env()
client.images.pull('apline')
time.sleep(30) # I will explain this later
output = client.containers.run(
'apline', 'ls inputs -al',
mounts=[inputs]
).decode('utf-8')
for line in output.split('\n'):
print(line)
So. I used time.sleep
to have time to dive into first container and check if needed file is presed. Yes it is, my file is inside first container. But output of deepest container sees no files inside inputs
directory.
What am I doing wrong?