Building a docker image doesnt stop because of minecraft server continuing to run

So I have been trying to learn docker for a few days now and set a first goal for me. I want to run a spigot server inside a docker container and later on the road combine that with a BungeeCord network. I have run into problem. My dockerfile runs without problems but once it reaches the point where it starts the minecraft server, the images stops building. I think this is due to the server continuing to run and not returning a code 0 to show docker to keep on running. Am I wrong with my idea, and if not, how can I fix the problem?

Here is my Dockerfile:

FROM ubuntu:14.04

RUN apt-get update
RUN apt-get install openjdk-7-jre icedtea-7-plugin -y
RUN apt-get install wget -y
RUN mkdir mc_server && cd mc_server/
RUN wget
RUN java -Xms1536m -Xmx1536m -Dcom.mojang.eula.agree=true -jar spigot_server.jar nogui

This way the server starts up but docker never finishes building. I hope I made my problem clear.

Greetings, Joel


Replace that last RUN with CMD.

RUN / ADD / .. are used to build the static container environment where you want to run your application in. Everything that happens before running the actual application.

CMD and ENTRYPOINT define what's supposed to happen inside the container once you docker run it. This is where the startup script / call goes for the program.

The result of the Dockerfile is similar to a computer that's shut down but has everything installed on the harddrive including a script that autostarts the application. Turn it on and everything starts to run.

PS: there are several existing images

Need Your Help

IBOutlets properties between two classes doesn't retain. Deallocated?

objective-c cocoa retain nstextfield iboutlet

I'm trying to figure out why my NSTextFields are only retained in the first method sendVarsToButton but not in the updateTotal method. I need to access the values from the TextField set in the first

ASP.NET Custom Server Control not refreshing in designer

c# visual-studio-2010 designer custom-server-controls

I have a written an ASP.NET Custom Server Control, which I have working. This control inherits from CompositeControl and has different views that it can show during its life time. The best analogy ...