This project provides a Docker Compose setup to run a dedicated Subnautica Nitrox multiplayer server. The server's network traffic is routed through a VPN connection using the gluetun Docker image, ensuring your server's public IP address is masked. It includes a custom Dockerfile for the Nitrox server, setting up a Wine environment and VNC access for remote management.
-
VPN Integration: All Nitrox server traffic is routed through a VPN using Gluetun.
-
Isolated Environment: The Nitrox server runs in a dedicated Docker container, keeping your host system clean.
-
Wine Environment: Subnautica Nitrox server (a Windows application) runs seamlessly on Linux via Wine.
-
VNC Access: Manage the Nitrox server cmd via VNC (exposed on port
5900). -
Web Access: Manage the Nitrox server cmd via a browser (exposed on http://localhost:8080).
-
Task Manager: Task Manager started by default so that you could manage the running processes.
-
Persistent Data: Wine prefix and Nitrox server data are persisted via Docker volumes, so your configurations and game saves remain even if the container is recreated.
-
Customizable: Easily configure VPN settings, user IDs, and the Subnautica installation path.
Before you begin, ensure you have the following installed on your system:
-
Docker You may be able to use another program like podman aswell (try and let me know)
Follow these steps to get your Nitrox server up and running:
-
Clone the repository: If you haven't already, clone this repository to your local machine:
git clone your-repository-url cd your-repository-directory(Replace
your-repository-urlandyour-repository-directorywith your actual repository details.) -
Prepare VPN Configuration: Obtain your OpenVPN client configuration file (
.ovpn) from your VPN provider. Place this file somewhere accessible on your host machine.Then, update the
gluetunservice in yourdocker-compose.ymlto point to this file. For example, if your.ovpnfile is at/home/user/myvpn.ovpn:# docker-compose.yml services: gluetun: volumes: - "/home/user/myvpn.ovpn:/gluetun/custom.conf:ro" # <-- Update this line -
Prepare Subnautica Installation: Ensure you have a copy of the Subnautica game files on your host machine. This setup requires the full game installation to run the Nitrox server.
Update the
nitroxservice indocker-compose.ymlto point to your Subnautica installation directory. For example, if your game is installed at/mnt/games/Subnautica:# docker-compose.yml services: nitrox: volumes: - "/mnt/games/Subnautica:/subnautica" # <-- Update this line(Make sure this path contains the
Subnautica.exeand other core game files.) -
Configure User IDs (Optional but Recommended): To avoid potential permission issues with the persistent volumes, it's recommended to set the
PUIDandPGIDenvironment variables in thenitroxservice to match your host user's User ID and Group ID.You can find your UID and GID by running
id -uandid -grespectively in your terminal.# docker-compose.yml services: nitrox: environment: - "PUID=1000" # Replace with your user ID (e.g., 1000) - "PGID=1000" # Replace with your group ID (e.g., 1000) -
Review
supervisord.conf: Thenitroxservice mounts asupervisord.conffile from.docker/nitrox/supervisord.confinto the container. This file is crucial for managing the Nitrox server process and the VNC server. Ensure its contents are appropriate for your desired server behavior.
-
Start the services: Navigate to the directory containing your
docker-compose.ymlfile and run:docker-compose up -dThis command will build the
nitroxDocker image (if it hasn't been built already) and then start both thegluetunandnitroxcontainers in the background. -
Monitor Logs: To check the status and view the real-time logs of your containers, use:
docker-compose logs -f -
Connect to VNC (Optional): Once the
nitrox-servercontainer is running, you can connect to its VNC server on port5900from your host machine.Use any VNC client (e.g., RealVNC Viewer, Remmina) to connect to
localhost:5900. This will give you access to the desktop environment where the Nitrox server is running, allowing for GUI management if needed. -
Connect to Nitrox Server: Players can connect to your Nitrox server using the public IP address of your host machine (or the external IP provided by your VPN if you've configured port forwarding on your router for the VPN).
-
The default Nitrox server game port is
11000(UDP). -
The Nitrox web administration interface (if enabled within Nitrox) is exposed on port
8080(TCP).
-
This service acts as a VPN client, routing all network traffic from the nitrox service through the specified VPN connection.
-
image: qmcgaw/gluetun: Uses the official Gluetun Docker image. -
cap_add: - NET_ADMIN: Required capability for VPN functionality within the container. -
devices: - /dev/net/tun:/dev/net/tun: Mounts the TUN device, which is essential for VPN operation. -
volumes:-
./data/gluetun:/gluetun: A persistent volume for Gluetun's configuration and data. -
/path/to/ovpn/client/cfg.ovpn:/gluetun/custom.conf:ro: Crucial: Replace/path/to/ovpn/client/cfg.ovpnwith the absolute path to your OpenVPN client configuration file on your host machine. The:roflag mounts it as read-only inside the container.
-
-
environment:-
VPN_SERVICE_PROVIDER=custom: Indicates that a custom VPN configuration file is being used. -
VPN_TYPE=openvpn: Specifies the OpenVPN protocol. -
OPENVPN_CUSTOM_CONFIG=/gluetun/custom.conf: Points to the mounted custom OpenVPN configuration file within the container. -
TZ=Etc/UTC: Sets the timezone for the container.
-
This service builds and runs the Subnautica Nitrox server within a Wine environment.
-
build: Instructs Docker Compose to build the image using thenitrox.Dockerfilelocated in the.dockerdirectory. -
container_name: nitrox-server: Assigns a user-friendly name to the running container. -
volumes:-
./data/wine:/home/user/.wine:Z: Persistent storage for the Wine prefix. This ensures your Wine configuration, installed components, and any Nitrox-related Wine data persist across container restarts. The:Zflag allows Wine to access files outside the Wine prefix. -
./data/nitrox:/nitrox: Persistent storage for Nitrox server-specific files, such as server configurations, logs, and potentially game saves generated by the server. -
./.docker/nitrox/supervisord.conf:/etc/nitrox_supervisord.conf:ro: Mounts the Supervisor configuration file, which manages the Nitrox server and VNC processes within the container. -
/path/to/subnautica:/subnautica: Crucial: Replace/path/to/subnauticawith the absolute path to your Subnautica game installation directory on your host machine. This is where the Nitrox server will find the game files it needs.
-
-
environment:-
PUID=1000,PGID=1000: (Optional) These specify the User ID and Group ID that theuserinside the container will use. Adjust these to match your host user's UID/GID for proper file permissions on the mounted volumes. -
TZ=Etc/UTC: Sets the timezone for the container. -
SUBNAUTICA_INSTALLATION_PATH=/subnautica: Specifies the path to the Subnautica installation within the container, matching the volume mount.
-
-
ports:-
5900:5900: Maps the container's VNC port to the host's port 5900. -
8080:8080: Maps the container's port 8080 to the host's port 8080 (for Nitrox web admin, if applicable). -
11000:11000/udp: Maps the container's UDP port 11000 to the host's UDP port 11000 (the primary Nitrox game port).
-
-
restart: "unless-stopped": Configures the container to restart automatically unless it is explicitly stopped by the user.
This Dockerfile defines the build process for the nitrox-server image.
-
FROM fedora:42: Uses Fedora 42 as the base operating system for the container. -
Installs essential packages including
wine(for running Windows applications),wget,golang,tigervnc-server(for VNC access),supervisor(for process management),openbox(a lightweight window manager),xdg-utils,Xvfb(a virtual framebuffer), andmingw64-win-iconv. -
Downloads and makes executable
winetricks(a helper for Wine),easy-novnc, andwstcp(tools for VNC over websockets). -
Creates a non-root
userfor security and sets up necessary directories. -
install-wine.sh: Copies and executes a custom script to install a specific version of Wine (from Kron4ek's Wine Builds) into the system. -
Sets
useras the default user and/nitroxas the working directory. -
CMD [ "/usr/bin/supervisord", "-c", "/etc/nitrox_supervisord.conf" ]: The default command executed when the container starts, launching Supervisor to manage the Nitrox server and VNC.
This script is executed during the Docker image build process for the nitrox service.
-
It downloads a pre-built Wine version (defaulting to
10.12from Kron4ek's Wine Builds) and extracts it to/opt, then copies its contents to/usr/. -
The
WINE_VERSIONcan be overridden by an environment variable during the Docker build if a different Wine version is desired.
(The content of this script was not provided, but its presence suggests custom startup logic for the Gluetun container. If you have custom requirements for Gluetun beyond its standard configuration, this script would handle them.)
-
VPN Connection Issues: If the Nitrox server cannot connect or appears to be using your host's IP, check the
gluetuncontainer logs for errors:docker-compose logs gluetunEnsure your
.ovpnfile is valid, correctly formatted, and accessible at the path specified indocker-compose.yml. -
Nitrox Server Not Starting: Examine the
nitrox-servercontainer logs for any errors or startup messages:docker-compose logs nitroxYou might also need to connect via VNC (
localhost:5900) to see the Wine application's graphical output or any pop-up error messages that might appear. -
Permissions Errors: If you encounter
Permission Deniederrors, especially when the containers try to write to the mounted volumes (./data/wine,./data/nitrox), double-check yourPUIDandPGIDsettings indocker-compose.yml. Ensure they match the user ID and group ID of the user on your host machine that owns the./datadirectory. -
Subnautica Path: Verify that the volume mount in
docker-compose.yml(/path/to/subnautica:/subnautica) correctly point to the complete and valid Subnautica game directory on your host machine. The Nitrox server needs access to these files to run.
