I'm relatively new to Docker.
I'm currently trying to run docker container on MacOS. The container is based on itzg/minecraft-server
image. Running the container normal way works fine, however, what I want to do is sync all Minecraft server data with a specific directory.
For example, I want to make sure that when I create a docker container, all the data is created or synced with /Users/myname/MCServer
(for example).
I learned here that I can do that by just appending -v as an argument, and then adding the directory that the server data should be located on.
I tried the following first:
docker run -v /Users/myname/Documents/MC Servers/Docker/Test:/data -d -it -p 32930:32930 -e TYPE=PAPER -e ONLINE_MODE=false -e SERVER_PORT=32930 -e EULA=TRUE -e VERSION=1.8.8 --name OpenSourcee itzg/minecraft-server
Well, that did not work so well throwing:
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
After some research, I figured out I could use ` sign to achieve the wanted effect. Also, I learned that MC Servers directory must not contain a space in the name, so I renamed it to MC_Servers. I also added sudo (but tried without as well). Here's the new command:
sudo docker run -v `/Users/myname/Documents/MC_Servers/Docker/Test` -d -it -p 32930:32930 -e TYPE=PAPER -e ONLINE_MODE=false -e SERVER_PORT=32930 -e EULA=TRUE -e VERSION=1.8.8 --name OpenSourcee itzg/minecraft-server
Unfortunately, that did not work as well, this time throwing:
zsh: permission denied: /Users/myname/Documents/MC_Servers/Docker/Test
After the error, server starts, but there are no files in /Users/myname/Documents/MC_Servers/Docker/Test
...
I'd really appreciate if someone can tell me if -v tag is a way to make docker use the given directory to create my Minecraft server in and put all it's data into and if it is, than how to solve the permission error I'm experiencing.
Thanks!