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.
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:
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 .