HHH
HHH

Reputation: 6485

How to copy file to a docker volume

I have a docker volume called hadoop_conf created at the default location /var/lib/docker/volumes/hadoop_conf/_data/. I need to copy some files from the host machine to this directory so the container can read them. My user has permission to run docker command but it does not have sudo access and copying into that directory requires sudo access. Is there any alternative to copy some files to this directory? any docker command?

Upvotes: 0

Views: 1220

Answers (1)

leeman24
leeman24

Reputation: 2899

You can use docker cp to copy files from your host to a container with hadoop_conf already mounted. You do not need sudo privileges for this.

https://docs.docker.com/engine/reference/commandline/cp/

docker cp myfile.txt mycontainer:/path/to/hadoop_conf_volume/

Upvotes: 1

Related Questions