0

I have this part of my python code which iterates through the folder and add file names to the list.

base_path = D:/tests/resources

for file in glob.glob(f'{base_path}/eox/data/eur/*.txt'):
    lst.append(file)

Now I have the docker images where I assume it should do the same thing after running this docker command.

docker run -i --rm -v D:/tests/resources:/tmp/output dockerimg:latest prepare --base_path D:/tests/resources

but somehow the list is empty even though D:/tests/resources have txt files in it. Is it because the volume is not mounted correctly?

2
  • to answer question whether volume is mounted correctly just manually login to the running container and check the dir ... docker run only keeps container running for duration of command ... there are other ways to launch a container which depend whether image runs a server or other long running process Commented Aug 6, 2021 at 13:02
  • I just checked it and it is present there. Commented Aug 6, 2021 at 13:28

1 Answer 1

1

The syntax for bind mount is:

-v source_path_in_host:destination_path_in_container

This means for -v D:/tests/resources:/tmp/output, the folder in host's D:/tests/resources will be mapped into /tmp/output in container.

Additional, prepare --base_path D:/tests/resources in fact won't be run on host, but will be executed in container. So, for the script prepare, it should accept the --base_path as /tmp/output for command input, not D:/tests/resources.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.