Guides

How to make a CS2 server for friends: Workshop map or Docker

Host a Workshop map for friends, or run your own CS2 dedicated server in Docker with a login token, ports and a password.

By CSgoFriendsPublished Last checked

Illustration for "How to make a CS2 server for friends: Workshop map or Docker"
Illustration: CounterStrikeGO

This guide covers two ways to play Counter-Strike 2 (CS2) with friends. Since Valve’s March 18, 2026 update, you can host a Workshop map on your own machine and friends can join from the Friends list. For a dedicated server, this guide uses the joedwards32/CS2 Docker image.

That image comes from the joedwards32/CS2 project on GitHub, not from Valve, and is released under the MIT license. The requirements and commands in the Docker sections are the ones in its README.

How to make a private server for friends without a dedicated server

In its March 18, 2026 update post, Valve wrote: “Want to set up your own custom game? Head over to your Workshop Maps tab in the Play menu, and make sure to turn on ‘Open Party.’ Now, when you start playing your workshop map you’ll host a game on your machine, and your friends will be able to join.”

  1. Subscribe to maps on the Steam Community Workshop.

  2. Open the Workshop Maps tab in the Play menu and turn on Open Party.

  3. Start the Workshop map. You host the game on your machine.

  4. Your friends join you from the Friends list.

The same post covers custom games on a community server or hosted locally. Friends can join them directly from the Friends list “as long as the server allows it,” Valve wrote. In the patch notes, Valve wrote that friends playing a Practice or Workshop map can be joined through the friends menu if they have Open Party set.

What a dedicated server needs

The README for the joedwards32/CS2 image says it “contains the dedicated server of the game.” The README lists these repositories:

  • Docker Hubjoedwards32/cs2
  • GitHubghcr.io/joedwards32/cs2

The README lists these minimum system requirements for the image:

Resource Minimum
CPUs 2
RAM 2GiB
Disk space 60GB, in the container or on a persistent volume mounted at /home/steam/cs2-dedicated/

The README adds that more space may be required if you plan to install mods. It also says you must have at least 60GB of free disk space.

How to get a game server login token

The image’s commands take a game server login token (GSLT) in the SRCDS_TOKEN variable. You create tokens on Steam’s Game Server Account Management page, where you log in with your Steam account. The page lists these account requirements:

  • The account must not be currently community banned or locked.
  • The account must not be limited.
  • The account must have a qualifying registered phone.
  • The account must own the game for which you are creating a game server account.
  • The account may create 1000 game server accounts.

The same page also says:

  • A token that goes unused for a long period of time (the game server never logs in) will expire. You can regenerate an expired token on the page.
  • If you reset your Steam password through the Steam help web site, or Steam Support resets it, all your GSLTs are regenerated.

How to make a CS2 server with Docker

Run the container

Put your token in a shell variable, then start the container. This is the command from the README:

$ SRCDS_TOKEN="..."
$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2

Keep data when the container is recreated

The README also gives a version with a bind mount, for data persistence when the container is recreated:

$ mkdir -p $(pwd)/cs2-data
$ chown 1000:1000 $(pwd)/cs2-data
$ SRCDS_TOKEN="..."
$ docker run -d --name=cs2 -e SRCDS_TOKEN="$SRCDS_TOKEN" -v $(pwd)/cs2-data:/home/steam/cs2-dedicated/ -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp joedwards32/cs2

The chown line makes sure the directory is writable by the unprivileged container user with uid 1000, known as steam.

Use Docker Compose

The project also has an example compose file. Update the passwords and SRCDS_TOKEN in it, as the README says, then run:

$ docker compose --file examples/docker-compose.yml up -d cs2-server

Ports for a CS2 server

The docker run command above publishes port 27015 over TCP and UDP and port 27020 over UDP:

Port Protocol What the README and Valve’s console variables say
27015 TCP and UDP The server listen port (CS2_PORT, default 27015). Valve’s console variable list describes hostport as the host game server port, default 27015.
27020 UDP The default SourceTV/CSTV port (TV_PORT).

The README describes an optional CS2_RCON_PORT setting that makes remote console (RCON) listen on an alternative port. If you use it, map the chosen port with TCP, for example by adding -p 27050:27050/tcp to the docker run command or the port to the compose file.

How to set a server password

The README lists CS2_PW, empty by default, as the optional CS2 server password, and you pass it with -e like the token:

-e CS2_PW="..."

In the start script, the password is added to the server’s launch arguments as +sv_password only when CS2_PW is set. Valve’s console variable list describes sv_password as the “Server password for entry into multiplayer games.”

RCON has its own password, set with CS2_RCONPW, which defaults to changeme in the README. Valve’s list describes rcon_password as the remote console password.

Server name and player count

These variables set how the server appears and how many people it holds:

  • CS2_SERVERNAME sets the visible name for your private server. The default is changeme. Valve’s list describes hostname as the hostname for the server.
  • CS2_MAXPLAYERS sets the maximum number of players. The default is 10.

CS2_LAN switches LAN mode on (1) or off (0). Valve’s list describes sv_lan as a LAN server with no heartbeat, no authentication and no non-class C addresses.

Game mode and map

The README sets the mode with CS2_GAMEALIAS, such as casual, competitive or deathmatch. If the alias is not defined, CS2_GAMETYPE (default 0) and CS2_GAMEMODE (default 1) are used instead. The map settings are:

  • CS2_MAPGROUP is the map pool, default mg_active. It is ignored if Workshop maps are defined.
  • CS2_STARTMAP is the start map, default de_inferno. It is also ignored if Workshop maps are defined.

For Workshop content, the README says support is experimental. CS2_HOST_WORKSHOP_MAP takes a Steam Workshop map ID to load on server start, and CS2_HOST_WORKSHOP_COLLECTION takes a collection ID to download. With a collection set, you can pick maps through RCON with ds_workshop_listmaps and ds_workshop_changelevel $map_name.

The README also lists bot settings: CS2_BOT_DIFFICULTY (0 easy, 1 normal, 2 hard, 3 expert), CS2_BOT_QUOTA for the number of bots and CS2_BOT_QUOTA_MODE (fill or competitive).

What the start script does

When the container starts, the script runs SteamCMD to download updates. SteamCMD logs in anonymously and runs app_update. If that fails, the script retries, up to three attempts in total.

Next, the script writes your settings into the server’s config files and launches the server with -dedicated, -port, -console, -usercon, -maxplayers and +map. The launch also gets +sv_setsteamaccount with your token if SRCDS_TOKEN is set, and +sv_password if CS2_PW is set.

The script runs pre.sh before the server starts and post.sh after it stops. With a persistent volume mounted, you can edit these scripts for custom actions, such as enabling metamod.

Updating the server

The README says: “The container will automatically update the game on startup, so if there is a game update just restart the container.”

If you break the game through your customizations, set STEAMAPPVALIDATE to 1 and SteamCMD will validate and redownload the game files. The default is 0, which skips validation.

Playing on community servers

For joining servers that other people run, see the guide to CS2 community servers.

FAQ

Can I play CS2 with friends without running my own server?

Yes, with a Workshop map. Turn on Open Party in the Workshop Maps tab of the Play menu and start the map. Friends can then join you from the Friends list.

Where do I get the game server login token?

Steam’s Game Server Account Management page creates them for accounts that meet the listed requirements. The page says not to distribute tokens to third parties.

What happens to my token if I reset my Steam password?

All your game server login tokens are regenerated, according to the Steam page. A token that goes unused for a long period also expires, and you can regenerate it on the same page.

Which ports does the Docker image use?

The README’s command publishes 27015 on TCP and UDP and 27020 on UDP. Port 27015 is the default listen port, and 27020 is the default SourceTV/CSTV port.

How do I put a password on my server?

Set CS2_PW when you start the container. The start script then passes it to the server as +sv_password.

How do I update the server?

Restart the container. The README says it updates the game automatically on startup.

Sources