0

I have a Raspberry Pi with Ubuntu Snappy on it.

I've installed minecraft server with

 docker pull itzg/minecraft-server

Following the instructions from https://hub.docker.com/r/itzg/minecraft-server/ I try to run

docker run -d -p 25565:25565 --name mc itzg/minecraft-server

or

   docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server

However I get the following error:

$ docker run -d -it -e EULA=TRUE -p 25565:25565 --name mc itzg/minecraft-server
FATA[0000] Error response from daemon: Conflict. The name "mc" is already in use by container a401d710b3c3. You have to delete (or rename) that container to be able to reuse that name. 

However, the docker ps reports no instance running

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

I did try to rename it to mc2 as the error suggests, but the result is only more errors

Core question is, how do I properly make the minecraft-server run and resolve the error above ?

It is my first experience with docker, so please explain as clearly as possible.

Additional info :

$ docker ps -a
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS               NAMES
08b7682eb487        itzg/minecraft-server:latest   "mc:latest"         38 minutes ago                                              cranky_rosalind     
d913adca07da        itzg/minecraft-server:latest   "mc"                39 minutes ago                                              furious_yonath      
e7fba87a02e4        itzg/minecraft-server:latest   "/start"            40 minutes ago                                              mc2                 
c3f3a1af49e3        itzg/minecraft-server:latest   "mc"                49 minutes ago                                              lonely_turing       
a401d710b3c3        itzg/minecraft-server:latest   "/start"            About an hour ago                                           mc                  
456bb2e52d8d        itzg/minecraft-server:latest   "/start"            About an hour ago                                           furious_bohr        
0

When you run a container, by default, it remains in your "history" (this is the "docker ps -a"). You can remove it either by doing "docker rm $containerid" or you can pass "--rm=true" during run to auto-remove it when it's shut down. The auto-remove is usually the recommended way for "temporary/one-time" containers.

Normally, if you do not provide a specific name, the system picks 2 random words and ends up auto generating a random name. However, in your case, you specified a name. This means that from that point on you need to do "docker start $name" and "docker stop $name". (alternatively you can use the $containerid instead of $name) Your other option is to stop and remove the container, and then you can re-launch it (re-create it).

Alternatively (not recommended), you can keep picking a new name each time and setting it -- in your case, mc3 will work. Then mc4, etc, but that doesn't make sense here...if you are going to do this, might as well leave out "--name"

So first run this to clean out all your past-ran containers:

docker stop $(docker ps -a -q)

and

docker rm $(docker ps -a -q)

Now, you have the following options (pick one - I suggest the first):

docker run --rm=true -d -p 25565:25565 --name mc itzg/minecraft-server

Every time you shut down the container, it will blow away all settings/info/etc and next time you will start as though for the first time.

or

docker run --rm=true -d -p 25565:25565 --name mc itzg/minecraft-server

and then followed each time by a:

"docker stop mc" - to stop it and "docker start mc" - when you want to start it again

This will "preserve your settings", however, in your case you don't have a mounted volume, so there is nothing to really preserve. The end result will be roughly the same as in #1.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.