Mounting a data volume without overwriting the container directory

How do I mount an existing container directory to the host without deleting the files in the container’s directory?

docker run -it -v ~/myHostDirectory:~/someContainerDirectory imageName /bin/bash

~/someContainerDirectory in the container gets cleared out

Hello,

It isn’t that it is deleting files inside the container, but they are hidden. This is simply how mounts work. If I were to plug in a flash drive and mount it to ~/someDirectory, then anything in ~/someDirectory would be masked by the files available in the new mount. The volumes feature in docker works the same way.

/Jeff

@programmerq Is there any workaround for this? I am very new to Docker and volumes.