
Game Configuration: Ports & Networking
This is Part 5 of the Game Configuration series. Ports define how players connect to your game server and how GameCP routes traffic.
How Ports Work
Every game server needs at least one port for players to connect. GameCP uses port mappings that connect a port on the host node to a port inside the Docker container.
When a game server is created, GameCP automatically assigns available ports on the node. The port mapping in the game config defines the defaults and variables β the actual assigned ports may differ per server.
Port Mappings
Each port mapping has three properties:
| Property | Description |
|---|---|
| Host Port | The default port on the node (what players connect to) |
| Container Port | The port inside the Docker container |
| Variable | An environment variable name that holds the assigned port value |
Example: Minecraft
A typical Minecraft config has one port:
- Host:
25565| Container:25565| Variable:PORT
When a server is created, if port 25565 is already in use, GameCP assigns the next available port (e.g., 25566). The PORT variable is set to 25566, and the startup command can reference ${PORT} to bind to the correct port.
Games with Multiple Ports
Some games need several ports. For example, ARK: Survival Evolved might need:
- Game Port: Host
7777| Container7777| VariablePORT - Query Port: Host
27015| Container27015| VariableQUERY_PORT - RCON Port: Host
27020| Container27020| VariableRCON_PORT
Port Linking
The Link Host Ports option keeps all host ports in sync β when the primary port changes, other ports shift by the same offset. This prevents port conflicts when running multiple servers.
Adding and Removing Ports
Click Add Port to create a new mapping. For each port:
- Set the default host and container port numbers
- Assign a variable name so startup commands and configs can reference the port
- The variable name should be uppercase (e.g.,
PORT,QUERY_PORT,RCON_PORT)
Tips
- The first port mapping is typically the main game port with variable
PORT - Always assign variable names β without them, your startup command can't dynamically reference the port
- Use the variable in your command line arguments:
-port ${PORT}or-queryport ${QUERY_PORT} - The Monitoring section can auto-populate ports when you select a query type β look for the clickable port badges