I\'m trying to build a data container for my application in Docker. I run this command to expose some volumes:
docker run --name svenv.nl-data -v /etc/environmen
I guess because you are not mounting a file but instead declaring a mount. Try this notation instead: -v <full path to a file you want to overwrite the target with>:/etc/environment
Suppose you are under Linux, run the following code
docker run -it --rm -v /local_dir:/image_root_dir/mount_dir image_name
Here is some detail:
-it: interactive terminal
--rm: remove container after exit the container
-v: volume or say mount your local directory to a volume
Since the mount function will 'cover' the directory in your image, your should always make a new directory under your images root directory.
Visit official documentation Use bind mounts to get more information.
You should use:
-v /etc/environment:/etc/environment
instead of:
-v /etc/environment
The former maps container volume to the host volume.
The latter tries to create a new volume at /etc/environment
and fails since this directory already exists.