Skip to content

Container environment variables

Gameye injects a set of environment variables into every running container. Read them from your entrypoint script or game server process to discover where the session is running, which ports are mapped, and how to identify the container in your own systems.

For port configuration during onboarding, see Networking mode affects the Dockerfile.

VariableDescriptionExample
GAMEYE_REGIONRegion where the session is runningeu-central-1
GAMEYE_APPLICATIONApplication name (the image field in API calls)my-game-server
GAMEYE_IPHost IP address that clients connect to203.0.113.42
GAMEYE_CONTAINERUnique container (session) identifierc595bc6f-8522-4a62-95cd-8742136643ea
GAMEYE_ORGANIZATIONOrganization that owns the sessionmy-studio

These variables are always present. You do not need to pass them when creating a session.

Port variables are created for each port exposed by your application. The name follows a fixed prefix plus the protocol and container port:

GAMEYE_PORT_{protocol}_{containerPort}
VariableMeaning
GAMEYE_PORT_UDP_7777Ephemeral host port mapped to UDP 7777 inside the container
GAMEYE_PORT_TCP_80Ephemeral host port mapped to TCP 80 inside the container

With host networking, your entrypoint must read these variables at startup and pass the resolved port numbers to your game server. With bridge networking, the orchestrator maps ports automatically from your EXPOSE directives — port variables are still available if your server needs to advertise them.

When ingress routing is enabled for your application, Gameye also injects externally reachable port numbers using this pattern:

GAMEYE_INGRESS_PORT_{protocol}_{containerPort}
VariableMeaning
GAMEYE_INGRESS_PORT_UDP_7777Externally reachable UDP port for container port 7777
GAMEYE_INGRESS_PORT_TCP_80Externally reachable TCP port for container port 80

Use GAMEYE_INGRESS_PORT_* when you need the port clients reach through Gameye’s ingress layer. Use GAMEYE_PORT_* for the host-level mapping inside the container’s networking context.

Older integrations may still reference these names. Gameye continues to inject them alongside the current names for backward compatibility. Prefer the current names in new code.

Legacy nameCurrent name
GAMEYE_SESSION_IDGAMEYE_CONTAINER
GAMEYE_HOSTGAMEYE_IP
GAMEYE_IMAGEGAMEYE_APPLICATION
#!/bin/bash
"$UE4_PROJECT_ROOT/MyGame/Binaries/Linux/GameServer" MyGame \
-sessionName=$GAMEYE_CONTAINER \
-port=$GAMEYE_PORT_UDP_7777 \
-GameServerQueryPort=$GAMEYE_PORT_UDP_1024 \
"$@"
status=$?
if test $status -eq 0; then
echo "Server exited normally"
else
echo "Server exited with code: $status"
fi

Gameye injects the variables above automatically. They are separate from values you pass when creating a session:

MechanismHow to setPurpose
Built-in variables (this page)Injected by Gameye at container startRuntime identity, networking, and placement
env field on POST /sessionYour API request bodyCustom configuration for your game server (e.g. MAX_PLAYERS)
labels field on POST /sessionYour API request bodyArbitrary metadata for filtering and correlation in your own systems

The labels.env field returned by session API responses reflects the built-in variables available inside the container. See Using container labels for how labels are structured.