yusuf
yusuf

Reputation: 3781

Accessing the files out of docker container

I have created a docker container image, and working inside the container (setting up filesystem, creating code files, installing dependencies etc).

On my Ubuntu machine, I keep a huge file under a directory so called /dataset/my_data/.

When I work in the container, it is not straightforward to access the above directory. Is there any possibility to access it from inside the container image interactively? If yes, how?

Upvotes: 0

Views: 63

Answers (1)

Sami Hult
Sami Hult

Reputation: 3082

You can mount the directory as a volume:

docker ... --mount type=bind,source=/dataset/my_data,target=/some/directory

For example, to run a container called my-container with a bound volume:

docker run -it --mount \
  type=bind,source=/dataset/my_data,target=/target/directory \
  my-container

For all available possibilities, see Docker documentation.

Upvotes: 2

Related Questions