Docker Mounting removes existing file in directory

Viewed 18

I have a docker image whose context in directory /workspace is

# ls workspace
dir1  dir2

When I am mounting a volume in docker's /workspace directory this content is lost. Is there any way to retain these files?

# docker run command
docker run -d -t --net host --rm \
     -v $PWD:/workspace -w /workspace/workspace_1 \
     my_docker_image:latest /bin/bash

At this point content of directory is changes

# ls workspace
hostdir1  hostdir2

What I want to have is

# ls workspace
dir1  dir2  hostdir1  hostdir2
0 Answers
Related