This example demonstrates the usage of the Rust server Docker image for production use on a Linux Server. It also can be utilised to run multiple Rust servers on one host.
It contains the following features:
pull_policy
to always, so docker compose always pulls the latest
image when firing up the serverClone the repo and create the .env file:
git clone https://github.com/max-pfeiffer/rust-game-server-docker.git
cd examples/docker-compose-production
cp .env-example .env
Edit the .env
file to your liking.
Start the server (create and start the container):
docker compose up -d
Stop the server (stop and remove containers, networks):
docker compose down
As Facepunch releases an update every month, you need to update your Rust server as well. So you need a new, updated Rust server image.
As the docker compose file uses the latest
tag for the Rust server image, the only thing you need to do is
stopping/removing and creating/starting the container with docker compose. Docker then pulls the up-to-date Rust server
image and starts the server. And you are done with your server update. :smiley:
For instance, you can automate this with a cron job. Check out rust-server-update.sh, which is
a simple script you can add as a daily job to your /etc/crontab
. That way you ensure your server is always up-to-date.