Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 3.16 KB

README.md

File metadata and controls

69 lines (53 loc) · 3.16 KB

Dockerized Garry's Mod server

Runs your Garry's Mod server inside Docker container as an executable

Features

  • Gmod running under non-root user (steam)
  • Working luarefresh. You can update your scripts and changes will apply instantly
  • Installed CSS content
  • You can run commands in your container like it's not containered server
  • Correct GetConVarString("hostip") if run with docker-compose (if you edit ip inside .env)
  • tmysql4, luasocket and some .dll modules works fine

Examples

For advanced example and docker-compose file look inside example folder.

Also you can run your server with docker run. Simple example:

docker build -t gmod-server . ; docker run --rm -it --name gmod \
    -p 27015:27015/udp \
    -v $PWD/addons:/gmodserv/garrysmod/addons/ \
    gmod-server \
        -port 27015 \
        -tickrate 32 \
        -maxplayers 8 \
        +map gm_construct \

Notes

  • This image requires ~7GB of free space
  • Main locations inside containter is /gmodserv/garrysmod, /gmodserv/steamcmd and /gmodserv/content/css
  • Ready to use (builded) images located on ghcr.io, not on docker hub
  • Such modules like gmsv_socket_linux.dll requires additional port forwarding rules. Example. If you plan to use 27030/tcp then you need to add following option to docker run command: -p 27030:27030/tcp

docker run tips and tricks

  • --rm option. If you use it the container will automatically removed after srcds process being killed. You should not remove trash containers by hands with this param
  • --name anyname assign pretty name to your container, so you can delete it by name instead of hash
  • -d option runs container in background. You can attach them with docker attach container_name (don't use with --rm).
  • -it there is 2 options where -t allocate a pseudo-TTY (required) and -i which allow you to interact with gmod console (run commands etc)
  • docker logs -f container_name let's receive logs from server!
  • docker exec -it container_name bash connect to container shell