Putting game servers in Docker containers. Because it makes life easier.
A set of game servers that have been wrapped with Docker. All images arecomposed of other images in this repository, except for base. Most imageswill auto-download any dependencies they have (eg, factorio server filesor sourcemod for srcds), making it almost one command to install a server.No binaries are stored in this repo, so make sure you have internet todownload them with.
Includes a utility script start_server.sh
which mounts save data to anexternal volume and sorts out networking for you.
Assuming you are on a blank server with Git and docker installed:
git clone https://github.com/OpenSourceLAN/gameservers-docker.git .
./build.sh factorio
./start_server.sh factorio
# Or
docker run -it --net=host -e "SERVER_NAME=Some really cool server"\
-v `pwd`/save:`cat factorio/mounts` --name factorio factorio
Most servers have environment variables that can be used to configure them.Read the README.md file in each directory to see what is available.
There is a tutorial on the Open Source LAN websitewhich will step you through building and using the images.
Contributions are welcome. Submit a pull request or open an issue.
All additions should follow these suggestions:
We want to expose all game servers directly to our LAN, and the --host
optionmeans we will get port conflicts. There is an alternative approach which usesthe ipvlan or macvlan docker network driver.
# Creates a docker network that's bridge with your layer 2 network
# Subnet should match the IP range and subnet of your network.
# ip-range is the CIDR block of IP addresses to assign to containers
# parent is the name of the interface you'd like to bridge containers to
docker network create --driver ipvlan --subnet=10.0.0.0/24 -o parent=eth0 --ip-range 10.0.0.16/28 --gateway 10.0.0.1 gameservers
# If the above command doesn't work, try using macvlan instead of ipvlan
# Starts your game server inside the layer 2 network
docker run -it --rm --net=gameservers csgo /steam/csgo/srcds_run -game csgo +sv_lan 1 +map cs_office
You can now see the CSGO server from another server on your network.
These are the instructions for building a swarm.
In addition to the swarm, one also needs a docker registry (I think).
These are the following gotchas that you need to be aware of:
/etc/defaults/docker
to contain: DOCKER_OPTS="-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock"
DOCKER_OPTS
value: --insecure-registry=registry-hostname:5000
-e reschedule:on-node-failure
(todo: figure out why the container doesn't get auto-started on the new host).Also note that a race condition exists - when the host comes back up, it will start the old container, and whenthe docker swarm manager container starts, it will detect the container was moved and kill it.Run the master like this:
docker run -d -v /mnt:/data --name consul \
-p 8300:8300 \
-p 8301:8301 \
-p 8301:8301/udp \
-p 8302:8302 \
-p 8302:8302/udp \
-p 8400:8400 \
-p 8500:8500 \
-p 53:53/udp \
progrium/consul -server -advertise 10.0.0.167 -bootstrap-expect 3
and the other two like this:
docker run -d -v /mnt:/data --name consul \
-p 8300:8300 \
-p 8301:8301 \
-p 8301:8301/udp \
-p 8302:8302 \
-p 8302:8302/udp \
-p 8400:8400 \
-p 8500:8500 \
-p 53:53/udp \
progrium/consul -server -advertise 10.0.0.197 -join 10.0.0.167
Double check all 3 are present in cluster by doing curl http://localhost:8500/v1/status/peers
.
Ensure every instance has:
Make the easy start script support passing environment variables to the container
Make an easy way to import config files in to the servers (eg mounting cfg directories)
Add more games
This project is licensed under GPL 3.0. See LICENSE for more information.
简介 仓库是集中存放镜像的地方,注册服务器是存放仓库的具体服务器,每个服务器可以有多个仓库,每个仓库可以有多个镜像。 仓库的出现是为了避免镜像太多难以管理的局面。 仓库分为公共仓库和私有仓库。 Docker 官方维护了一个公共仓库 docker hub 有时使用 Docker Hub 这样的公共仓库可能不方便,会侵犯到企业的隐私,所以我们可以搭建私人仓库去使用 我们用server1虚拟机做实验,让
1. Configmap配置管理 - Configmap用于保存配置数据,以键值对形式存储。 configMap 资源提供了向 Pod 注入配置数据的方法。 旨在让镜像和配置文件解耦,以便实现镜像的可移植性和可复用性。 典型的使用场景: 1.填充环境变量的值 2.设置容器内的命令行参数 3.填充卷的配置文件 ##使用较多 - 创建ConfigMap的方式有4种:
docker部署kafka(单机) 注意:ip 换成你宿主机的真实ip !!! 环境搭建 第一步 搭建zookeeper环境 docker pull zookeeper docker run -d --name zookeeper -p 2181:2181 -t zookeeper 第二步 创建kafka环境 (ip换成你宿主机的真实ip) docker pull wurstmeister/ka
Docker是改变游戏规则的人。 但这不是万能的解决方案。 (Docker is a game-changer. But it is not a one-size-fits-all solution.) There are many good things about Docker. It packs, ships, and runs applications as a lightweight,
Docker仓库 仓库(Repository)是集中存放镜像的地方。以下介绍一下 Docker Hub。当然不止 docker hub,只是远程的服务商不一样,操作都是一样的。 docker仓库是用来保存镜像的位置,docker提供一个注册服务器(register)来保存多个仓库,每个仓库又可以包含多个具备不同的tag的镜像 docker运行中使用的默认仓库是docker Hub 公共仓库,使用公
下载registry镜像 [root@foundation20 kiosk]# docker search registry NAME DESCRIPTION STARS OFFICIAL AUTOMATED
""" [root@docker ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.5 (Maipo) # 阿里云开源镜像站: https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/ # 官方站点: https