Running Counter-Strike 1.6 Server on Docker

CS 1.6

Counter-Strike 1.6 is a classic first-person shooter game that is still enjoyed by many players. If you want to set up a dedicated server for Counter-Strike 1.6 using Docker, this guide will walk you through the process step by step.

1. Install Docker: Make sure you have Docker installed on your system. Docker is available for Windows, macOS, and Linux. You can download Docker from the official website here.

2. Pull the Docker Image: Open a terminal or command prompt and run the following command to pull the latest Docker image for the Counter-Strike 1.6 server:

docker pull ghcr.io/stenstromen/csserver:latest

This will download the required Docker image to your local machine.

3. Run the Counter-Strike 1.6 Server: To start the server, use the following command:

docker run -d --rm \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e MAP="cs_assault" \
-e MAXPLAYERS="16" \
ghcr.io/stenstromen/csserver:latest

Let’s break down the options in this command:

  • The -d flag runs the container in the background (detached mode).
  • The --rm flag automatically removes the container when it stops.
  • The -p option maps the host’s port 27015 to the container’s port 27015 for both TCP and UDP traffic.
  • The -e option allows you to set environment variables for the server. In this example, we set the MAP variable to “cs_assault” and the MAXPLAYERS variable to “16”. You can change these values as needed.

4. (Optional) Add a Config File:

If you want to use a custom configuration file for your Counter-Strike 1.6 server, you can mount it to the container using the -v option. Here’s an example of how to do it:

docker run -d --rm \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e MAP="cs_assault" \
-e MAXPLAYERS="16" \
-v csserver.cfg:/home/csserver/serverfiles/cstrike/csserver.cfg \
ghcr.io/stenstromen/csserver:latest

This command assumes that you have a file named csserver.cfg in the current directory. Adjust the path and file name as necessary.

5. Example Config File (csserver.cfg):

hostname "Docker CSServer"
rcon_password "p455w0rd"
sv_password "p455w0rd"
log on
sv_logbans 1
sv_logecho 1
sv_logfile 1
sv_log_onefile 0
sv_aim 1
pausable 0
sv_maxspeed 320
mp_timelimit 20
sv_cheats 0
exec listip.cfg
exec banned.cfg

You can save this configuration to a file named csserver.cfg and mount it to the container using the -v option as described in Step 4.

6. Enjoy Your Counter-Strike 1.6 Server!

Leave a Reply

Your email address will not be published. Required fields are marked *