Minecraft Docker Image: game storage persistence

I’m trying to use this Vanilla Minecraft docker image to run a Minecraft server for friends, but can’t seem to get its data to live beyond the lifetime of the container itself.

I am running on an Ubuntu host, and on that host I have created /opt/minecraft where I’d like any outside-of-container persisted data to live.

  • error with Installation of rpy2 on mac
  • Docker-Machine stuck on creating default
  • Best way to transfer data to named volume of Docker
  • How to specify static ip address for multiple overlay networks in Docker
  • How to make postgres.app db accessible to docker container?
  • Installing mod_proxy_html on docker httpd 2.1
  • To test my approaches I would:

    • start the container (commands provided below with each approach I tried)
    • join the server
    • dig a circle around myself as an indicator that I’ve been there
    • disconnect from the server
    • stop the container docker stop generated_name
    • start the container again using the same command as above
    • join the server again
    • is the circle I dug still there / has the world changed?

    I have yet to find an approach that doesn’t lose my data. Here’s what I’ve tried:

    Approach 1: all in one

    I tried just mounting /opt/minecraft as /minecraft in the container:

    docker run -d -v /opt/minecraft:/minecraft -p 25565:25565 webhippie/minecraft-vanilla

    Approach 2: individual volumes

    I noted in the Dockerfile that there are 3 volumes listed:

    VOLUME ["/minecraft/merge", "/minecraft/world", "/minecraft/logs"]

    So after destroying and recreating an empty /opt/minecraft and creating the three folders to mount, I tried this instead:

    docker run -d -v /opt/minecraft/world:/minecraft/world -v /opt/minecraft/merge:/minecraft/merge -v /opt/minecraft/logs:/minecraft/logs -p 25565:25565 webhippie/minecraft-vanilla

    In both approaches 1 and 2 I can see that some files have been created in the folder(s) mounted as volumes (so I don’t think it’s a permissions issue), but it doesn’t seem to be enough to keep my world from being created from scratch again after a container restart. What am I missing?

    I’m also new to Minecraft. Maybe there’s some nuance about the game that I’m missing, instead?

  • Can i use Docker for creating exe using pyinstaller
  • docker network port binding
  • How to configure DNS (and/or loadbalancing) for Docker Swarm Manager
  • Install PHP7 fpm and memcached with Docker
  • How to understand Amazon ECS cluster
  • Commit a docker container but doesn't have any changes I made
  • One Solution collect form web for “Minecraft Docker Image: game storage persistence”

    Your second approach should be totally fine to keep the world, at least that’s how I’m doing that.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.