Build base image. There's only server files in this image.
cd base
docker build -t <base_image_name> .
Then build final image. There's a startup shell script to start the server.
cd server
docker build -t <final_image_name> .
The default <base_image_name>
is longjunyu/theforest-base
.
If you want to use another name, don't forget to change to first line of server/Dockerfile
to the one you set. FROM <base_image_name_you_set>
Before creating the container, you need create a file for config and a folder for saves.
Here is a tutorial about how to creating the config file. Dedicated Server Tutorial
docker cli
docker run -d \
--name=<container_name> \
--net=host \
-v <path_to_config>:/data/config/config.cfg \
-v <path_to_saves>:/data/config/saves \
<final_image_name>
There's some issues with bridge network mode. You will meet DS configurations tests: failed
and the server WON'T startup
docker run -d \
--name=<container_name> \
--net=bridge \
-p 8766:8766/udp \
-p 27015:27015/udp \
-p 27016:27016/udp \
-v <path_to_config>:/data/config/config.cfg \
-v <path_to_saves>:/data/config/saves \
<final_image_name>
There are also some additional parameters that can be set to the container.
Parameter | Function |
---|---|
-e USER_ID=1000 |
for UserID - see below for explanation |
-e GROUP_ID=1000 |
for GroupID - see below for explanation |
-e TZ=Asia/Shanghai |
specify a timezone to use, see this list. |
When using volumes (-v flags), permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user PUID and group PGID.
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish.
In this instance USER_ID=1000 and GROUP_ID=1000, to find yours use id your_user as below:
id <your_user>
Example output:
uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)
docker pull longjunyu/theforest-server