From docker doc:
When you use a bind mount, a file or directory on the host machine is
mounted into a container
That means, you can mount a local file or directory in your local machine into docker container filesystem. That means - All files and directories from the mounted localhost files or directories will be mounted to the docker container, and will override the docker container files if filenames are identical (same for directories).
Important: the docker container would also mount its files / directories to your local filesystem. However, in contrast to the opposite direction (local -> docker container), docker container would not override any files or directories in your local host file system.
And also as a note, If you want to avoid override a file from localhost to docker container filesystem you would use the most basic volume: anonymous volume.
From main comment seems you actually want to run the following:
docker run -d -p 25565:25565 --name mc -e EULA=TRUE --restart=always -v /home/docker/minecraft/_data:/data itzg/minecraft-server
I'm not into minecraft servers, but you should note you use in this command your local directory: /home/docker/minecraft/_data
. I reckon you ensure it has the proper content (because it is going to be mounted to your docker container file system to /data
. Or - this can be an empty folder in your local, and docker container would generate some data there so you will be able to look at this data later on.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…