/docker-steamcmd-wine

:whale: Run a Steam powered Windows game server in Docker.

Primary LanguageDockerfileMIT LicenseMIT

docker-steamcmd-wine

Run a Steam powered Windows game server in Docker.

Dependencies

VS Code extensions

Manually starting the container

Unless the game you are attempting to run was purchased on the Steam marketplace authentication should not be necessary so you can omit the Game configuration arguments in the docker build command below. In cases you do need to authenticate, on first build attempt a Steam Guard code is generated which is sent to you by either e-mail or SMS. Due to this, you must update the command below to include the GUARDCODE value and re-run the build process within 30 seconds of receiving the message.

$ docker build -t steamcmd . --build-arg USERNAME=<steam-username> --build-arg PASSWORD=<steam-password> --build-arg GUARDCODE=<steam-guard-code> --build-arg APPID=<steam-appid> --build-arg RUNCMD=<command>
$ docker run -d --network host steamcmd

Accessing the container

$ docker exec -it <container-id> /bin/bash

Game configuration arguments

--build-arg Description
USERNAME Steam account Username (optional)
PASSWORD Steam account Password (optional)
GUARDCODE Steam Guard code (optional)
APPID Steam application ID
RUNCMD Commands to run in the app directory.
HEADLESS yes | no (default: yes)
RDP_SERVER yes | no (default: no)
RDP_PASSWD System account Password (default: games)

Launching in Remote-Containers

In the VS Code Command Palette choose "Open Folder in Container" which will launch the server in a Docker container allowing for realtime development and testing.

By default, a Miscreated Dedicated Server will be launched. To change the game edit the VS Code devcontainer.json and rebuild the Docker container.

Managing the game server

The following command can be executed within the Docker container:

$ service game-server {start|stop|restart}

Overriding game sources

In cases where you have an existing game set-up (e.g. configuration, database, workshops) you can synchronize these items during the game installation process by adding them to the /files directory. Mirroring that of the existing game directory, files that already exist will be overwritten.

Networking workarounds

The most likely culprit to the "I cannot find my server.." issue is one of the following:

  1. Your router NAT has limited support for UPnP (Universal Plug and Play) which results in game loopback requests being denied. To resolve this you must manually configure port range forwarding in your router to mirror the TCP/UDP ports exposed by the game server. This will ensure routing to your game server occurs within the network.
  2. Your game server binds to the server internal IP vs router external (public) address. To resolve this you must add an IP alias to your server network device (see below). Once complete, you *may need to configure the game to launch using that same address thereby ensuring the correct IP is broadcasted to the game network.

(*) Entirely dependent on your network set-up (e.g. corporate vs home) and in most cases is not required.

Adding an IP alias (spoofing your external IP address)

$ sudo ip a add <ip-address>/24 dev <interface-name>
$ sudo sh -c "echo '<ip-address> localhost' >> /etc/hosts"

Connecting with an RDP client

If the container was started with RDP_SERVER=yes you can make a remote desktop connection using a client-side application supported by your operating system.

Application Operating System
Microsoft Remote Desktop Android
Microsoft Remote Desktop OSX, iOS
Microsoft Remote Desktop Windows
Reminna Remote Desktop Client Linux

Login credentials

Unless RDP_PASSWD has been defined, you can login to the server using the following account information:

Username: games
Password: games

Related projects

References

Contributions

If you fix a bug, or have a code you want to contribute, please send a pull-request with your changes.

Versioning

This package is maintained under the Semantic Versioning guidelines.

License and Warranty

This package is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

docker-steamcmd-wine is provided under the terms of the MIT license

Steam is a registered trademark of Valve Corporation.

Author

Marc S. Brooks