Docker Community Forums

Share and learn in the Docker community.

Docker container won't stay running


(Churromancer) #1

Issue type: Docker Container won’t stay running
OS Version/build: Windows 10 Enterprise / Docker 17.09.1-ce-win42 (14687) Channel: Stable
App version: Custom 7 Days to Die Dedicated server image built off of official Ubuntu 16.04 image

Hi everyone,

I am learning Docker, and I decided to build a 7 Days To Die dedicated game server image to test my learning and experiment. I took the official Ubuntu image and then installed SteamCMD on it. I then took that image and created the following Dockerfile:

FROM churromancer/steamcmd:1.0

WORKDIR /root/Steam

RUN ./steamcmd.sh +login anonymous +force_install_dir ./7days +app_update 294420 validate +quit

WORKDIR /root/Steam/7days

COPY serverconfig.xml .

EXPOSE 26900/tcp 8080-8082/tcp 26900-26902/udp

ENTRYPOINT /root/Steam/7days/7DaysToDieServer.x86_64 -configfile=serverconfig.xml -logfile /dev/stdout

The image builds correctly and when I create a container from it the server starts and I see the output I’d normally see when a 7 Days To Die dedicated server is spun up. However, after the server starts the container then exits and stops. If I restart the stopped container, the same thing happens where it starts the server and then Docker exits. If I exec into my SteamCMD image and run all of these commands in my dockerfile manually, then the server starts and remains running.

This is how I am starting the container after building the image named “7days”:

docker container run --name testserver 7days

I have also tried the following with the same results:

docker container run -it --name testserver 7days

What is wrong with my Dockerfile or the command line syntax that is preventing the server from staying running? I understand that this is most likely an app issue and not an issue with Docker itself, but I am wondering if anyone else has experienced this type of behavior and if so were they able to modify something within the dockerfile and/or container to resolve?

Thank you all for your help!


(Unknown314159) #2

Though I can’t confirm (because I’m not experienced enough), I’m guessing that the container is exiting because the main thread, or process, has ended. This StackOverflow answer alludes to that:

My best (almost-uneducated) guess is that when you exec into the image, your presence is holding the container open.

Sorry I couldn’t be more help.


(Hillbillymark) #3

did you try it with the -d --detach option?