A Docker image for the Mednafen standalone server based on the official Alpine Linux image.
Mednafen-Server allows you to play many emulator games online via netplay using the Mednafen multi-system emulator.
Docker Tag | Version | Platform | Description |
---|---|---|---|
latest | 1.2 | amd64, arm64 | Latest release |
1.2 | 1.2 | amd64, arm64 | Latest release |
Environment variables • Password protection • Usage • Using Compose • Manual build • License
A few environment variables can be tweaked when creating a container to define the server configuration:
Click to expand
Variable | Default value | Description |
---|---|---|
MDFNSV_MAXCLIENTS | 50 | Maximum number of clients. |
MDFNSV_CONNECTTIMEOUT | 5 | Connection (login) timeout (in seconds). |
MDFNSV_PORT | 4046 | Port to listen on (TCP). |
MDFNSV_IDLETIMEOUT | 30 | Idle timeout (in seconds). Disconnect a client if no data is received from them since X seconds ago. |
MDFNSV_MAXCMDPAYLOAD | 5242880 | The maximum data (in bytes) in the payload of a command to be received by the server (including save state transfers). |
MDFNSV_MINSENDQSIZE | 262144 | Soft send queue start size (in bytes), and minimum size (memory allocated) it will shrink to. |
MDFNSV_MAXSENDQSIZE | 8388608 | Maximum size (in bytes) each internal per-client soft send queue is allowed to grow to. The client is dropped on overflowing this size. |
MDFNSV_PASSWORD | Server password (NOT recommended, see the section below). | |
MDFNSV_ISPUBLIC | 0 | Make the server public. Ignore the password environment variable (if set) and remove any existing password from the configuration file. |
Descriptions mostly taken from the original standard.conf file in the Mednafen-Server sources.
The server can be protected with a (clear, unencrypted) password and defined in various ways:
— Bind mounting a text file containing the password into the container.
The mount point path must be /run/secrets/mednafenserver
.
This is the recommended method. See the second example in the section below.
— Using the MDFNSV_PASSWORD
environment variable when creating the container.
This method is NOT recommended for production, as all environment variables are visible via docker inspect
to any user that can use the docker
command.
— By editing the server.conf
file located beside the server binary and accessed by mounting a volume on /home/mednafen
.
Example 1:
Run a public server on default port 4046
with a maximum of 4 clients
and a connection time out of 15 seconds
:
— The ulimit
option is optional but highly recommended for the server to run properly.
docker run -d \
--name mednafen-server \
--ulimit memlock=-1 \
-p 4046:4046/tcp \
-e MDFNSV_MAXCLIENTS=4 \
-e MDFNSV_CONNECTTIMEOUT=15 \
-e MDFNSV_ISPUBLIC=1 \
-i k4rian/mednafen-server
Example 2:
Run a password-protected server with default settings on port 40451
:
— In this example, the password is stored in the secret.txt
file located in the current working directory.
docker run -d \
--name mednafen-server \
--ulimit memlock=-1 \
-p 40451:40451/tcp \
-e MDFNSV_PORT=40451 \
-v "$(pwd)"/secret.txt:/run/secrets/mednafenserver:ro \
-i k4rian/mednafen-server
Example 3:
Run a password-protected testing server on port 4444
:
docker run -d \
--name mednafen-server-test \
--ulimit memlock=-1 \
-p 4444:4444/tcp \
-e MDFNSV_PORT=4444 \
-e MDFNSV_PASSWORD="testing" \
-i k4rian/mednafen-server
Requirements:
— Docker >= 18.09.0
— Git (optional)
Like any Docker image the building process is pretty straightforward:
- Clone (or download) the GitHub repository to an empty folder on your local machine:
git clone https://github.com/K4rian/docker-mednafen-server.git .
- Then run the following command inside the newly created folder:
docker build --no-cache -t k4rian/mednafen-server .