Deploy and configure your SAMP server easily
206
This is a simple Docker image for running a SA-MP server. You can find the Git repository for this image here: https://github.com/MichaelAceAnderson/samp-docker
By default, the server loads an empty gamemode with no filterscripts. You can change them either by mounting a volume to the /server directory or by creating a new image that inherits from this one and adds the necessary files.
⚠️ NOTE: The log file being mapped to the output, setting a volume on the log file might prevent it from being displayed correctly in your terminal
To run your own server, you can create a new Dockerfile that inherits from this one and adds the necessary files. For example:
FROM michaelace/samp-server:0.3.7-R2-1
# Copy from local files to inside the container
COPY server/filterscripts ./filterscripts
COPY server/gamemodes ./gamemodes
COPY server/npcmodes ./npcmodes
COPY server/scriptfiles ./scriptfiles
COPY server/server.cfg .
# Expose the port with the UDP protocol
EXPOSE 7777/udp
The current entrypoint is located at /entrypoint.sh. By default, it only starts the server with ./samp03svr, but it allows executing a custom command if provided as an argument. You can achieve this command by adding CMD to your Dockerfile:
FROM michaelace/samp-server:0.3.7-R2-1
# Copy from local files to inside the container
COPY server/filterscripts ./filterscripts
COPY server/gamemodes ./gamemodes
COPY server/npcmodes ./npcmodes
COPY server/scriptfiles ./scriptfiles
COPY server/server.cfg .
# Copy custom script
COPY custom-script.sh .
# Make the script executable
RUN chmod +x custom-script.sh
# Change the starting command
CMD ["./custom-script.sh"]
Then, you can build and run the new image:
⚠️ NOTE: If you are running the image under a WSL environment, UDP ports can't be forwarded to the host machine. You will need to use the IP address of the WSL machine to connect to the server, which can be found by running ip addr show eth0 in the WSL terminal.
docker build -t my-samp-server .
# ⚠️ It is mandatory to open the UDP port for the server to work properly
# ⚠️ The SAMP_RCON_PASSWORD environment variable has to be different from the default value (changeme) for security reasons
# The server will not run without SAMP_RCON_PASSWORD being set
# Remember to escape special characters in the password (e.g., $ -> \$)
docker run -p 7777:7777/udp -e SAMP_RCON_PASSWORD="n3Wpãs\$w0rD*_''" my-samp-server
Every server.cfg variables can be replaced by the environment variables values as long as they are named properly in uppercase with the SAMP_ prefix. Example: rcon_password -> SAMP_RCON_PASSWORD="newpassword", gamemode0 -> SAMP_GAMEMODE0="script1 otherscript2"
Here is the table for all known variables until SAMP 0.3.DL:
| Key | ENV_VAR | Type | Read-only | Rule | Default |
|---|---|---|---|---|---|
| echo | SAMP_ECHO | string | Yes | No | Executing Server Config... |
| rcon_password | SAMP_RCON_PASSWORD | string | No | No | changeme |
| rcon | SAMP_RCON | bool | No | No | 1 |
| gamemode0 | SAMP_GAMEMODE0 | string | No | No | grandlarc1 |
| filterscripts | SAMP_FILTERSCRIPTS | string | Yes | No | |
| plugins | SAMP_PLUGINS | string | Yes | No | |
| announce | SAMP_ANNOUNCE | bool | No | No | 1 |
| query | SAMP_QUERY | bool | No | No | 1 |
| hostname | SAMP_HOSTNAME | string | No | No | SA-MP Server |
| language | SAMP_LANGUAGE | string | No | No | |
| mapname | SAMP_MAPNAME | string | No | Yes | San Andreas |
| gamemodetext | SAMP_GAMEMODETEXT | string | No | No | Unknown |
| weburl | SAMP_WEBURL | string | No | Yes | |
| version | SAMP_VERSION | string | Yes | Yes | |
| maxplayers | SAMP_MAXPLAYERS | int | Yes | No | 50 |
| sleep | SAMP_SLEEP | int | No | No | 5 |
| lanmode | SAMP_LANMODE | bool | No | No | 0 |
| bind | SAMP_BIND | string | Yes | No | |
| port | SAMP_PORT | int | Yes | No | 8192/7777 |
| conncookies | SAMP_CONNCOOKIES | int | No | No | 1 |
| cookielogging | SAMP_COOKIELOGGING | int | No | No | 0 |
| connseedtime | SAMP_CONNSEEDTIME | int | No | No | 300000 |
| minconnectiontime | SAMP_MINCONNECTIONTIME | int | No | No | 0 |
| messageslimit | SAMP_MESSAGESLIMIT | int | No | No | 500 |
| messageholelimit | SAMP_MESSAGEHOLELIMIT | int | No | No | 3000 |
| ackslimit | SAMP_ACKSLIMIT | int | No | No | 3000 |
| playertimeout | SAMP_PLAYERTIMEOUT | int | No | No | 10000 |
| mtu | SAMP_MTU | int | Yes | No | 576 |
| output | SAMP_OUTPUT | bool | No | No | 0 |
| timestamp | SAMP_TIMESTAMP | bool | No | No | 1 |
| logtimeformat | SAMP_LOGTIMEFORMAT | string | Yes | No | [%H:%M:%S] |
| logqueries | SAMP_LOGQUERIES | bool | No | No | 0 |
| chatlogging | SAMP_CHATLOGGING | int | No | No | 1 |
| db_logging | SAMP_DB_LOGGING | int | No | No | 0 |
| db_log_queries | SAMP_DB_LOG_QUERIES | int | No | No | 0 |
| onfoot_rate | SAMP_ONFOOT_RATE | int | Yes | No | 40 |
| incar_rate | SAMP_INCAR_RATE | int | Yes | No | 40 |
| weapon_rate | SAMP_WEAPON_RATE | int | Yes | No | 40 |
| stream_distance | SAMP_STREAM_DISTANCE | float | No | No | 300.0 |
| stream_rate | SAMP_STREAM_RATE | int | No | No | 1000 |
| maxnpc | SAMP_MAXNPC | int | No | No | 0 |
| myriad | SAMP_MYRIAD | bool | No | No | 0 |
| nosign | SAMP_NOSIGN | string | Yes | No |
Content type
Image
Digest
sha256:52b519954…
Size
64.4 MB
Last updated
almost 2 years ago
docker pull michaelace/samp-server:0.3.DL-R1