https://github.com/doctor-server/tf2-dedicated-server/actions/workflows/docker-publish-gpr.yml/badge.svg?branch=main](https://github.com/doctor-server/tf2-dedicated-server/actions/workflows/docker-publish-gpr.yml)
This repository uses Docker and SteamCMD to download and check for updates to the TF2 dedicated server. If there's an update, it pushes the latest Docker image to the GitHub Docker registry.
| Image Name | Image Tag | Image Size |
|---|---|---|
| ghcr.io/doctor-server/tf2-dedicated-server | latest | 12.53 GB |
| ghcr.io/doctor-server/tf2-dedicated-server | slim | 4.04 GB |
slimremoves unnecessary files like maps, which helps reduce the image size.
To install the TF2 dedicated server from the command line, use one of the following commands:
shdocker pull ghcr.io/doctor-server/tf2-dedicated-server:latest
or, use slim tag for smaller image size and faster deployment. (Recommended)
shdocker pull ghcr.io/doctor-server/tf2-dedicated-server:slim
latest)First, create a temporary container to copy the necessary server files to your local tf directory:
docker create --name tf2-temp-server ghcr.io/doctor-server/tf2-dedicated-server:latest sleep infinity docker cp tf2-temp-server:/home/steam/serverfiles/tf/cfg ./tf docker cp tf2-temp-server:/home/steam/serverfiles/tf/maps ./tf docker cp tf2-temp-server:/home/steam/serverfiles/tf/materials ./tf docker rm tf2-temp-server
To run the TF2 server using Docker Compose, add the following service configuration to your docker-compose.yml file:
ymlservices: tf2-demo-server: image: ghcr.io/doctor-server/tf2-dedicated-server:latest command: ./srcds_run -console -game tf +sv_pure 1 +randommap +maxplayers 24 ports: - "27015:27015/tcp" - "27015:27015/udp" volumes: - ./tf/cfg:/tf/cfg - ./tf/maps:/tf/maps - ./tf/materials:/tf/materials restart: always tty: true stdin_open: true
slim)First, create a temporary container to copy the necessary server files to your local tf directory:
docker create --name tf2-temp-server ghcr.io/doctor-server/tf2-dedicated-server:slim sleep infinity docker cp tf2-temp-server:/home/steam/serverfiles/tf/cfg ./tf docker cp tf2-temp-server:/home/steam/serverfiles/tf/maps ./tf docker cp tf2-temp-server:/home/steam/serverfiles/tf/materials ./tf docker rm tf2-temp-server
Ensure you add at least one map to the maps folder in your local tf directory.
To run the TF2 server using Docker Compose, add the following service configuration to your docker-compose.yml file:
ymlservices: tf2-demo-server: image: ghcr.io/doctor-server/tf2-dedicated-server:slim command: ./srcds_run -console -game tf +sv_pure 1 +randommap +maxplayers 24 ports: - "27015:27015/tcp" - "27015:27015/udp" volumes: - ./tf/cfg:/tf/cfg - ./tf/maps:/tf/maps - ./tf/materials:/tf/materials restart: always tty: true stdin_open: true
To start the TF2 dedicated server, run the following command:
shdocker compose up -d
To attach to the running container, use:
shdocker attach <container_name>
To detach from the container without stopping it, use the key combination:
Ctrl + P, Ctrl + Q
This section is for github developer
Build the Docker Image
shdocker build -f Dockerfile.buildid -t remote-buildid:232250 --build-arg APP_ID=232250 .
Retrieve the Remote Build ID
Run the following command to get the build ID from the Docker container:
shdocker run --rm remote-buildid:232250 sh -c "cat buildid.txt"
To build the Docker image locally, run the following command:
shdocker build -t tf2-dedicated-server:latest --build-arg remote_buildid=<remote_buildid> --build-arg tag=latest .
shdocker build -t tf2-dedicated-server:slim --build-arg remote_buildid=<remote_buildid> --build-arg tag=slim .
To run the demo TF2 server locally, use Docker Compose:
shdocker compose up -d
To copy the server files to a local directory, use the following command:
docker cp tf2-demo-server:/home/steam/serverfiles/tf ./tf
Successfully copied 11.7GB to C:\GitHub\tf2-dedicated-server\tf
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务