Sign inSign up

k4rian/mednafen-server

By k4rian

•Updated about 2 years ago

A Docker image for the Mednafen standalone server.

Image
Networking
1

1.5K

k4rian/mednafen-server repository overview

docker-mednafen-server logo

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 TagVersionDescriptionPlatform
latest⁠1.2amd64, arm64Latest release
1.2⁠1.2amd64, arm64Latest release

⁠Environment variables

A few environment variables can be tweaked when creating a container to define the server configuration:

[Click to expand]
VariableDefault valueDescription
MDFNSV_MAXCLIENTS50Maximum number of clients.
MDFNSV_CONNECTTIMEOUT5Connection (login) timeout (in seconds).
MDFNSV_PORT4046Port to listen on (TCP).
MDFNSV_IDLETIMEOUT30Idle timeout (in seconds). Disconnect a client if no data is received from them since X seconds ago.
MDFNSV_MAXCMDPAYLOAD5242880The maximum data (in bytes) in the payload of a command to be received by the server (including save state transfers).
MDFNSV_MINSENDQSIZE262144Soft send queue start size (in bytes), and minimum size (memory allocated) it will shrink to.
MDFNSV_MAXSENDQSIZE8388608Maximum size (in bytes) each internal per-client soft send queue is allowed to grow to. The client is dropped on overflowing this size.
MDFNSV_PASSWORDServer password (NOT recommended, see the section below).
MDFNSV_ISPUBLIC0Make 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.

⁠Password protection

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.

⁠Usage

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

⁠Using Compose

See compose/README.md⁠

⁠Manual build

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 .

⁠License

GPL-2.0⁠

Tag summary

Content type

Image

Digest

sha256:84438a5e0…

Size

6.7 MB

Last updated

about 2 years ago

docker pull k4rian/mednafen-server