2

My datasets and codes are in different folders and they don't have immediate parent folder. I want my codes to access my datasets while using docker run. Is there a way to load both codes and datasets folder into workspace?

3

You can use Docker volume mounts at run time. For example:

$ mkdir -p app/src logs
$ touch app/src/foo.c logs/bar.txt
$ docker run --rm -v $PWD/app:/app -v $PWD/logs:/app/logs alpine ls -l /app /app/src /app/logs
/app:
total 8
drwxr-xr-x    2 1000     1000          4096 May  6 23:33 logs
drwxr-xr-x    2 1000     1000          4096 May  6 23:33 src

/app/logs:
total 0
-rw-r--r--    1 1000     1000             0 May  6 23:33 bar.txt

/app/src:
total 0
-rw-r--r--    1 1000     1000             0 May  6 23:33 foo.c

This mounts two directories on the host into the docker container. Notice in this example that inside the container, they are mount on inside the other.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.