# Factorio Dedicated Server

> Factorio dedicated game server for multiplayer.

- Category: Media & Entertainment
- Difficulty: beginner
- Components: factorio
- Tags: factorio, game-server, strategy, gaming, multiplayer
- Source: https://docker.recipes/media/factorio-server

## Overview

Factorio is a construction and management simulation game where players build and maintain automated factories to produce increasingly complex items. Originally released by Wube Software in 2016, Factorio has become one of the most beloved strategy games for its deep automation mechanics, multiplayer cooperation, and extensive modding support. The game's dedicated server functionality allows multiple players to collaborate on massive factory projects in persistent worlds that continue running even when players are offline.

This Docker stack utilizes the factoriotools/factorio image to create a containerized Factorio dedicated server with persistent world storage and proper network configuration. The setup handles UDP game traffic on port 34197 for player connections and TCP traffic on port 27015 for RCON administration, while maintaining save files and server configurations in Docker volumes. The container automatically manages server startup, world generation, and crash recovery without requiring manual intervention.

This configuration is ideal for gaming communities, friends groups, and organizations wanting to host private Factorio servers with reliable uptime and easy maintenance. The containerized approach eliminates compatibility issues across different host systems while providing consistent performance and simplified backup procedures. Engineers and system administrators will appreciate the infrastructure-as-code approach for managing game server deployments alongside other containerized services.

## Features

- Automatic world generation with customizable map settings and seed values
- Built-in autosave functionality with configurable intervals and retention policies
- RCON administrative interface for remote server management and player administration
- Comprehensive mod support with automatic synchronization to connecting clients
- Player authentication integration with Factorio account system and whitelist management
- Configurable server settings including PvP modes, evolution factors, and pollution settings
- Detailed server console logging with chat history and administrative action tracking
- Save file versioning and corruption recovery mechanisms

## Use cases

- Gaming communities hosting persistent factory-building competitions and events
- Educational institutions teaching automation, logistics, and systems engineering concepts
- Remote teams using collaborative factory building as team-building exercises
- Modding communities testing and showcasing custom Factorio modifications
- Streamers and content creators hosting viewer participation factory projects
- Engineering groups demonstrating real-world manufacturing and supply chain principles
- Family and friend groups maintaining long-term collaborative building projects

## Prerequisites

- Minimum 2GB RAM allocation with 4GB recommended for large factories or modded servers
- UDP port 34197 accessible for game client connections through firewalls and NAT
- TCP port 27015 available for RCON administrative access if remote management needed
- Valid Factorio account credentials for server authentication and multiplayer features
- At least 5GB free disk space for save files, with additional space for mod storage
- Basic understanding of Factorio server settings and player permission systems

## docker-compose.yml

```yaml
services:
  factorio:
    image: factoriotools/factorio:latest
    container_name: factorio
    restart: unless-stopped
    ports:
      - "${FACTORIO_PORT:-34197}:34197/udp"
      - "27015:27015/tcp"
    environment:
      - SAVE_NAME=${SAVE_NAME:-world}
      - GENERATE_NEW_SAVE=${GENERATE_NEW:-true}
    volumes:
      - factorio_data:/factorio
    networks:
      - factorio-network

volumes:
  factorio_data:

networks:
  factorio-network:
    driver: bridge
```

## .env

```bash
# Factorio Server
FACTORIO_PORT=34197
SAVE_NAME=world
GENERATE_NEW=true
```

## Usage notes

- Server at localhost:34197 UDP
- Configure server-settings.json
- Place saves in /factorio/saves
- Supports mods

## Troubleshooting

- Players cannot connect to server: Verify UDP port 34197 is properly forwarded and accessible from external networks
- Server crashes with 'out of memory' error: Increase Docker container memory limits or reduce autosave frequency in server settings
- Mods fail to synchronize to clients: Check mod compatibility versions and ensure all required dependencies are installed on server
- Save file corruption on server restart: Enable multiple autosave slots and verify proper container shutdown procedures
- RCON connection refused: Ensure TCP port 27015 is exposed and RCON password is configured in server-settings.json
- New players spawn in wrong locations: Verify spawn point settings and check for conflicting mod configurations affecting player positioning

