本站支持搜索的镜像仓库:Docker Hub、gcr.io、ghcr.io、quay.io、k8s.gcr.io、registry.gcr.io、elastic.co、mcr.microsoft.com
"Oh, MAN! This is just like Counter-Strike!"
Source on Github
We also have a Left 4 Dead Docker Image - docker pull left4devops/l4d
Running a vanilla server can as simple as running:
docker run --name l4d2 \ --network host \ left4devops/l4d2
[!IMPORTANT] The above example uses host networking (
--network host), which is the preferred networking method, as it allows the game server to correctly identify the IP of connecting players and can be used to ban players or anyone on the net attempting to force access to RCON. To use host networking on windows or macOS, enable host networking from experimental features in Docker version 4.29.
Although the game server won't be able to correctly identify player's IP correctly, you can use Docker's default bridge networking mode instead. Ensure your game port is published using both the TCP and UDP protocols.
docker run --name l4d2-bridged \ -p 27015:27015/tcp \ -p 27015:27015/udp \ left4devops/l4d2
"Someone needs to restart that generator!"
srcds_run includes a watchdog to restart the server process in the event of a crash. However, you may want to include
the restart parameter to ensure your server comes back up after a reboot, like so:
docker run --name l4d2-reboot \ --restart unless-stopped \ left4devops/l4d2
"I hate elevators. I hate helicopters. I hate hospitals. And doctors and lawyers and cops..."
This section is in draft, see the discussion here for more detail.
There are a couple of ways you can achieve this:
mm_dedicated_force_servers [ip:port]. This will try to use your server when the game starts.STEAM_GROUP variable and choose to start the game from a Steam Group server in your lobby.openserverbrowser in game. This will make it appear as a
steam group server in the menu.connect [ip:port]If you wanted to play a custom campaign on your server, or include sourcemod, you can mount a directory with any custom
content into the /addons/ directory.
e.g. If your working directory had a addons folder:
docker run --name l4d2-server-addons \ -v $(pwd)/addons:/addons/ left4devops/l4d2
You can pass environment variables to your Docker Container to configure a number of common settings.
This is the name of you server, as shown in the Server Browser and Steam Group Servers. Defaults to Left4DevOps.
To change your hostname to BILLS HERE:
docker run --name l4d2-hostname \ -e HOSTNAME="BILLS HERE" \ left4devops/l4d2
"I need every one of you inside, now!"
To help hint to Steam where your server is located, set the REGION environment variable as one of the following
numeric regions:
| Location | REGION |
|---|---|
| East Coast USA | 0 |
| West Coast USA | 1 |
| South America | 2 |
| Europe | 3 |
| Asia | 4 |
| Australia | 5 |
| Middle East | 6 |
| Africa | 7 |
| World (Default) | 255 |
If your server was in Europe:
docker run --name l4d2-region \ -e REGION=3 \ left4devops/l4d2
Make your server easier to join, by attaching it to a Steam Group. Steam Group Servers are shown in the bottom right
corner of the Game menu and can be easily picked as a hosting option in Left 4 Dead 2. In game, players can press h to
show the message of the day and then join your steam group, so they can find it again in the future. You can find the ID
of your Steam Group at the top of the Admin page.
docker run --name l4d2-group \ -e STEAM_GROUP=666 \ left4devops/l4d2
Normally, your server will be available for anyone using the Best Available Dedicated setting in their lobby. You
can prevent this by setting STEAM_GROUP_EXCLUSIVE to true. Any member of your group will be able to start a game as
lobby leader.
docker run --name l4d2-group-exclusive \ -e STEAM_GROUP=666 \ -e STEAM_GROUP_EXCLUSIVE=true \ left4devops/l4d2
[!NOTE] Non members can still pick your server using
mm_dedicated_force_servers
The game should find the next free port after 27015 to host the game on. If using bridge networking, 27015 will usually
be picked automatically, as no other services should be running in the container. You may prefer to hardcode the game
port to simply your port forwarding or firewall configuration. Simply set PORT to your desired port. Game traffic and
RCON always operate on the same port number.
Change the port with host networking:
docker run --name l4d2-port \ -e PORT=27016 \ --network host \ left4devops/l4d2
or if using bridge networking, remember to expose your new ports:
docker run --name l4d2-port-bridged \ -e PORT=27016 \ -p 27016:27016/tcp \ -p 27016:27016/udp \ left4devops/l4d2
To make it slightly less painful to change the port, you could use:
PORT=27017 docker run --name l4d2-port-var \ -e PORT=$PORT \ -p $PORT:$PORT/tcp \ -p $PORT:$PORT/udp \ left4devops/l4d2
[!WARNING] When publishing your ports with bridge networking, ensure the same port is used for both client and host. Otherwise matchmaking will advertise the wrong port and new players will not be able to connect
Can be used to set the map when the server is first loaded. Defaults to the newest map for each game. The map names are
different in each game. You can get a full list of maps names by typing maps in your Developer Console. To start your
L4D2 server on Dead Center:
docker run --name l4d2-map \ -e DEFAULT_MAP=c1m1_hotel \ left4devops/l4d2
Sets the mode used by your server when it is first loaded. Defaults to coop, but can be changed from a lobby.
docker run --name l4d2-mode \ -e DEFAULT_MODE=versus \ left4devops/l4d2
Can be used to limit which game modes can be played on your server. Leave unspecified to allow all game modes. Values
include coop,realism,survival,versus,scavenge,dash,holdout,shootzones
docker run --name l4d2-modes \ -e GAME_TYPES="versus,mutation19" \ left4devops/l4d2
Run multiple games from the same container, with ports being automatically allocated by default. The PORT variable is
ignored. You can customise the behaviour of the different instances by mounting multiple server##.cfg files.
docker run --name l4d2-forked \ --network host \ -e FORK=2 -v $pwd/server01.cfg:/cfg/server01.cfg -v $pwd/server02.cfg:/cfg/server02.cfg left4devops/l4d2
Runs the server without needing to talk to Steam, but connecting players need a local IP address.
docker run --name l4d2-lan \ --network host \ -e LAN=true \ left4devops/l4d2
Son, we're immune, we're tired, and there's infected in the damn woods. Now cut the shit and let us in!
To issue commands to the server whilst you're playing on it, set an RCON password. Logging into a server with RCON also grants you vote kick immunity. To set a password:
docker run --name l4d2-rcon \ --network host \ -e RCON_PASSWORD=cuttheshitandletusin \ left4devops/l4d2
Then in game, once you have joined the server, open the Developer Console and type
rcon_password cuttheshitandletusin rcon
[!NOTE] Make sure the password is unique, as bad actors commonly attempt dictionary ***s.
srcds_runwill ban an IP after a few failed attempts. This can have the unintended side effect of banning everyone if using bridge networking.
Similar to RCON, the Network Console allows you to administrator your server, but using a telnet client. If not using
a password, I would strongly recommend using a firewall to block public access to the port. To start listening on port
***:
docker run --name l4d2-netcon \ --network host \ -e NET_CON_PORT=*** \ left4devops/l4d2
You could then connect using your telnet client:
telnet localhost ***
To set a net con password:
docker run --name l4d2-netcon-password \ --network host \ -e NET_CON_PORT=*** \ -e NET_CON_PASSWORD=cuttheshitandletusin \ left4devops/l4d2
Once connected via your telnet client, type PASS and then your password:
telnet localhost *** PASS cuttheshitandletusin
A telnet client is included in the image so you can connect using docker exec:
docker exec -it l4d2 telnet localhost ***
Got a small number of other settings you want to add? To spawn larger mobs more frequently:
docker run --name l4d2-args \ -e EXTRA_ARGS="+z_mega_mob_size 100 +z_mega_mob_spawn_min_interval 180 +z_mega_mob_spawn_max_interval 600" \ left4devops/l4d2
srcds_run will look for a server.cfg file. If you have lots of config, store them in a file and mount it to
/cfg/server.cfg.
docker run --name l4d2-server-cfg \ -v $(pwd)/server.cfg:/cfg/server.cfg left4devops/l4d2
You can completely replace the guided environment variable configuration by providing arguments when starting the container
docker run --name l4d2-command-line \ left4devops/l4d2 +hostname "Vannah Hotel"
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录方式配置轩辕镜像加速服务,包含7个详细步骤
在 Linux 系统上配置轩辕镜像源,支持主流发行版
在 Docker Desktop 中配置轩辕镜像加速,适用于桌面系统
在 Docker Compose 中使用轩辕镜像加速,支持容器编排
在 k8s 中配置 containerd 使用轩辕镜像加速
在宝塔面板中配置轩辕镜像加速,提升服务器管理效率
在 Synology 群晖NAS系统中配置轩辕镜像加速
在飞牛fnOS系统中配置轩辕镜像加速
在极空间NAS中配置轩辕镜像加速
在爱快ikuai系统中配置轩辕镜像加速
在绿联NAS系统中配置轩辕镜像加速
在威联通NAS系统中配置轩辕镜像加速
在 Podman 中配置轩辕镜像加速,支持多系统
配置轩辕镜像加速9大主流镜像仓库,包含详细配置步骤
无需登录即可使用轩辕镜像加速服务,更加便捷高效
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429