Docker Community Forums

Share and learn in the Docker community.

Docker Linux Game Server Not Working

Good day all,

So I am working on building a bunch of game servers that run inside docker. The idea is when the game updates, the base image updates( All game files) then there is a volume attached where the game is installed and all progress transfers allowing separation of game servers as well as minimizing the amount of updates need per game server. So I have started with PixARK. It is a windows only based server that uses steamcmd so I built a image from cm2network/steamcmd:root, installed wine32 and wine64, installed the game and ran it. It is using --net=host but it does not register the game on steam like it should. I looked at the log and got an error of not being able to find the Public IP address so I build my own steamcmd base image with wine using the docker file of cm2network/steamcmd and adding in wine but instead of using debian:buster-slim as the base I used deabain:buster. This got rid of the external IP error however I am still not able to get the server to show up inside the game. So I resorted to doing a build inside my Debian virtual machine, installed steamcmd, installed wine32 and wine64 (Almost the same way I did inside dockerfile) and ran exactly the same commands and it worked no problem. I am puzzled as to what is going on and why it is not working. What am I missing? Also my docker is running inside the same virtual machine I used to test the game on.

steamcmd-wine:lastest Dockerfile:

############################################################
# SteamCMD + wine + wine64
############################################################
FROM debian:buster

ARG PUID=1000

ENV USER steam
ENV HOMEDIR "/home/${USER}"
ENV STEAMCMDDIR "${HOMEDIR}/steamcmd"
#Add WINE environment variables
ENV WINEPREFIX /home/${USER}/.wine
ENV WINEARCH win64
ENV WINESERVER /usr/local/bin/wineserver64
ENV WINEDEBUG -all

# Install, update & upgrade packages
# Create user for the server
# This also creates the home directory we later need
# Clean TMP, apt-get cache and other stuff to make the image smaller
# Create Directory for SteamCMD
# Download SteamCMD
# Extract and delete archive
RUN set -x \
	&& dpkg --add-architecture i386 \
	&& apt-get update \
	&& apt-get install -y --no-install-recommends --no-install-suggests \
		lib32stdc++6=8.3.0-6 \
		lib32gcc1=1:8.3.0-6 \
		wget=1.20.1-1.1 \
		ca-certificates=20190110 \
		nano=3.2-3 \
		libsdl2-2.0-0:i386=2.0.9+dfsg1-1 \
		curl=7.64.0-4+deb10u1 \
		wine32=4.0-2 \
		wine64=4.0-2 \
	&& useradd -u "${PUID}" -m "${USER}" \
        && su "${USER}" -c \
                "mkdir -p \"${STEAMCMDDIR}\" \
                && wget -qO- 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar xvzf - -C \"${STEAMCMDDIR}\" \
                && \"./${STEAMCMDDIR}/steamcmd.sh\" +quit \
                && mkdir -p \"${HOMEDIR}/.steam/sdk32\" \
                && ln -s \"${STEAMCMDDIR}/linux32/steamclient.so\" \"${HOMEDIR}/.steam/sdk32/steamclient.so\" \
		&& ln -s \"${STEAMCMDDIR}/linux32/steamcmd\" \"${STEAMCMDDIR}/linux32/steam\" \
		&& ln -s \"${STEAMCMDDIR}/steamcmd.sh\" \"${STEAMCMDDIR}/steam.sh\"" \
	&& ln -s "${STEAMCMDDIR}/linux32/steamclient.so" "/usr/lib/i386-linux-gnu/steamclient.so" \
	&& ln -s "${STEAMCMDDIR}/linux64/steamclient.so" "/usr/lib/x86_64-linux-gnu/steamclient.so" \
	# Add symbolic links to wine as this is not done during wine install
	&& ln -s /usr/lib/wine/wine /usr/local/bin/wine \
	&& ln -s /usr/lib/wine/wine64 /usr/local/bin/wine64 \
	&& ln -s /usr/lib/wine/wineserver32 /usr/local/bin/wineserver32 \
	&& ln -s /usr/lib/wine/wineserver64 /usr/local/bin/wineserver64 \
	&& chmod +x /usr/local/bin/wine /usr/local/bin/wine64 /usr/local/bin/wineserver32 /usr/local/bin/wineserver64 \
	&& apt-get remove --purge -y \
		wget \
	&& apt-get clean autoclean \
	&& apt-get autoremove -y \
	&& rm -rf /var/lib/apt/lists/*

WORKDIR ${STEAMCMDDIR}

VOLUME ${STEAMCMDDIR}

pixark-server:latest Dockerfile:

###########################################################
# Dockerfile that builds a PixARK Linux Gameserver
###########################################################
FROM silentmecha/steamcmd-wine:latest

LABEL maintainer="silent@silentmecha.co.za"

ENV STEAMAPPID 824360
ENV STEAMAPP PixARK
ENV STEAMAPPDIR "${HOMEDIR}/${STEAMAPP}-dedicated"

COPY src/ ${HOMEDIR}

RUN set -x \
	&& mkdir -p "${STEAMAPPDIR}" \
	&& { \
		echo '@ShutdownOnFailedCommand 1'; \
		echo '@sSteamCmdForcePlatformType windows'; \
		echo '@NoPromptForPassword 1'; \
		echo 'login anonymous'; \
		echo 'force_install_dir '"${STEAMAPPDIR}"'; \
		echo 'app_update '"${STEAMAPPID}"'; \
		echo 'quit'; \
	   } > "${HOMEDIR}/${STEAMAPP}_update.txt" \
	&& chmod +x "${HOMEDIR}/entry.sh" \
	&& chown -R "${USER}:${USER}" "${HOMEDIR}/entry.sh" "${STEAMAPPDIR}" "${HOMEDIR}/${STEAMAPP}_update.txt" \
	&& bash "${STEAMCMDDIR}/steamcmd.sh" \
		+@sSteamCmdForcePlatformType windows \
		+login anonymous \
		+force_install_dir "${STEAMAPPDIR}" \
		+app_update "${STEAMAPPID}" validate \
		+quit \
	&& su ${USER} -c \
		"wine wineboot --init"

ENV MAP="CubeWorld_Light"\
	DELAYREGISTERSERVER=True\
	BRAWSOCKETS=True \
	SESSIONNAME="SessionName" \
	SERVERPASSWORD="666999" \
	SERVERADMINPASSWORD="letmein" \
	MAXPLAYERS=20 \
	RCONENABLED=True \
	RCONPORT=27017 \
	CULTUREFORCOOKING="en" \
	QUERYPORT=27016 \
	PORT=27014 \
	CUBEPORT=27018 \
	CUBEWORLD="Cubeworld" \
	ADDITIONAL_ARGS=""

USER ${USER}

VOLUME ${STEAMAPPDIR}

WORKDIR ${HOMEDIR}
	
CMD ["bash", "entry.sh"]

# Expose ports
EXPOSE 27015/tcp \
	27015/udp \
	${PORT}/tcp \
	${PORT}/udp \
	${QUERYPORT}/tcp \
	${QUERYPORT}/udp \
	${RCONPORT}/tcp \
	${RCONPORT}/udp \
	${CUBEPORT}/tcp \
	${CUBEPORT}/udp 

entry.sh:

#!/bin/bash
export WINEDEBUG=-all
cd ${STEAMAPPDIR}
wine64 ${STEAMAPPDIR}/ShooterGame/Binaries/Win64/PixARKServer.exe "${MAP}?listen?DelayRegisterServer=${DELAYREGISTERSERVER}?bRawSockets=${BRAWSOCKETS}?ServerPassword=${SERVERPASSWORD}?MaxPlayers=${MAXPLAYERS}?Port=${PORT}?QueryPort=${QUERYPORT}?RCONPort=${RCONPORT}?RCONEnabled=${RCONENABLED}?SessionName=${SESSIONNAME}?ServerAdminPassword=${SERVERADMINPASSWORD}?CULTUREFORCOOKING=${CULTUREFORCOOKING}" -RCONPort=${RCONPORT} -Port=${PORT} -NoBattlEye -NoHangDetection -CubePort=${CUBEPORT} -cubeworld=${CUBEWORLD} -server -log

then the run commands I used:

docker volume create pixark-server_data
docker volume create steamcmd_data
docker run -dit --name=pixark-server --net=host -e  SESSIONNAME="SilentMecha" -v steamcmd_data:/home/steam/steamcmd -v pixark-server_data:/home/steam/PixARK-dedicated  silentmecha/pixark-server bash

I know I overwrite my CMD with bash but that is to allow me to try figure out what is going on and why it is not working.

Any suggestions on what I could be doing wrong?

Some more info. Netstat results:

#Debain Virtual Machine running outside of docker

netstat -atnup
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      926/PixARKServer.exe
tcp        0      0 0.0.0.0:27018           0.0.0.0:*               LISTEN      926/PixARKServer.exe
tcp        0      0 127.0.0.1:53938         127.0.0.1:42133         ESTABLISHED 926/PixARKServer.exe
tcp        0      0 127.0.0.1:42133         127.0.0.1:53938         ESTABLISHED 926/PixARKServer.exe
udp        0      0 0.0.0.0:27015           0.0.0.0:*                           926/PixARKServer.exe
udp        0      0 0.0.0.0:27016           0.0.0.0:*                           926/PixARKServer.exe

#Debian Machine running inside of docker(Different PC)

netstat -atnup
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:27017           0.0.0.0:*               LISTEN      5770/PixARKServer.exe
tcp        0      0 0.0.0.0:27018           0.0.0.0:*               LISTEN      5770/PixARKServer.exe
tcp        0      0 127.0.0.1:47743         127.0.0.1:51906         ESTABLISHED 5770/PixARKServer.exe
tcp        0      0 127.0.0.1:51906         127.0.0.1:47743         ESTABLISHED 5770/PixARKServer.exe
udp        0      0 0.0.0.0:27014           0.0.0.0:*                           5770/PixARKServer.exe
udp        0      0 0.0.0.0:27015           0.0.0.0:*                           5770/PixARKServer.exe
udp        0      0 0.0.0.0:27016           0.0.0.0:*                           5770/PixARKServer.exe

So I did some more testing. If I use a base image (Debain or Ubuntu) and run the commands exactly like I did in my virtual machine it works. I am not sure if I am missing something inside my dockerfile or if there is something I am doing in my dockerfile that could be breaking everything. Any suggestions or advise would really be appreciated as I have been trying to do this for over a week and not getting anywhere