Docker Compose Setup
ThoriumLXC makes downloadable Git repositories available that provide the Docker configurations for running the emulation servers. This guide helps you understand the available commands.
Info
This page assumes the name of the compose file is compose.yaml
, and that you are running the commands within the directory containing the compose.yaml
file.
.
├── compose.yaml
├── mangosd.conf
├── realmd.conf
└── README.md
Prerequisites
Before you begin, ensure you have Docker and Docker Compose installed and configured on your machine. Running the command below within a Terminal environment confirms that Docker is accessible:
docker --version
If this command does not show a valid Docker version, refer to the official documentation on Docker’s website to install and set up Docker correctly. This will look something like the following, likely with a different version & build ID (27.3.1
, ce12230
):
Docker version 27.3.1, build ce12230
You can also verify Docker Compose by checking for its helpdoc:
docker compose --help
which will look roughly like the following:
Usage: docker compose [OPTIONS] COMMAND
Define and run multi-container applications with Docker
Options:
--all-resources Include all resources, even those not
used by services
--ansi string Control when to print ANSI control
characters ("never"|"always"|"auto")
(default "auto")
--compatibility Run compose in backward compatibility mode
--dry-run Execute command in dry run mode
--env-file stringArray Specify an alternate environment file
-f, --file stringArray Compose configuration files
--parallel int Control max parallelism, -1 for
unlimited (default -1)
--profile stringArray Specify a profile to enable
--progress string Set type of progress output (auto,
tty, plain, json, quiet) (default "auto")
--project-directory string Specify an alternate working directory
(default: the path of the, first
specified, Compose file)
-p, --project-name string Project name
Commands:
attach Attach local standard input, output, and error streams to a service's running container
build Build or rebuild services
config Parse, resolve and render compose file in canonical format
cp Copy files/folders between a service container and the local filesystem
create Creates containers for a service
down Stop and remove containers, networks
events Receive real time events from containers
exec Execute a command in a running container
export Export a service container's filesystem as a tar archive
images List images used by the created containers
kill Force stop service containers
logs View output from containers
ls List running compose projects
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart service containers
rm Removes stopped service containers
run Run a one-off command on a service
scale Scale services
start Start services
stats Display a live stream of container(s) resource usage statistics
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker Compose version information
wait Block until containers of all (or specified) services stop.
watch Watch build context for service and rebuild/refresh containers when files are updated
Run 'docker compose COMMAND --help' for more information on a command.
After you have confirmed the above, it means you are ready to proceed with this guide.
Pulling Docker Images
When you are in the project folder, you can download the images that the Docker Compose configuration requires by typing:
docker compose pull
This command fetches all the images declared in the compose.yml
file and stores them on your machine. If you already have a compatible version of these images, Docker may skip downloading or perform a quick update check.
Think of container images as downloading applications (program files) from your browser.
Starting the Server
Once the images are ready, you can start the emulation server by typing:
docker compose up
This action starts each container specified in the compose.yml
file. The Terminal will display output that shows the server initiating. If you want the server to keep running in the background so you can use the same Terminal window for other tasks, you can add the -d
flag:
docker compose up -d
By adding -d
, you instruct Docker Compose to run in "detached" mode, meaning the containers keep running until you stop them, even if you close your Terminal window.
Attaching to the Server
Once the server is running, you may want to attach to it to interact with the server. To attach to a running server, use:
docker compose attach <service_name>
Replace <service_name>
with the name of the service defined in your compose.yml
file, such as mangosd
. This command connects your terminal to the container’s standard output, letting you monitor logs and server activity in real time.
Tip
Avoid canceling the attach
command using Ctrl+C (or equivalen for your operating system), as this will stop the server. To safely detach without interrupting the server, press:
- Ctrl+P then Ctrl+Q on Linux/Mac
- Ctrl+P then Ctrl+Q on Windows (PowerShell or Command Prompt)
If you do accidently close it, you can just run the steps outlined in "Starting the Server"
Stopping the Server
If you need to pause the running server without removing the containers, you can type:
docker compose stop
Stopping works well if you plan to resume operations soon and would like to avoid recreating containers. It halts the running processes but leaves them on your system in a stopped state.
Removing Containers
To remove the containers completely and free up any resources they consume, you can type:
docker compose down
Removing containers can be useful if you want a clean environment each time you start the server. When you run down
, Docker Compose not only stops the containers but also deletes them from your system.
Full Cleanup
If you wish to remove all the containers and the underlying images they depend on, you can type:
docker compose down --rmi all
This command fully cleans everything associated with this project’s Docker environment, including the images. Keep in mind that if you run this command and later choose to start the server again, Docker will need to pull the images once more, which may take some time depending on your internet speed.
Viewing Logs
While the server is running, you can inspect its logs by typing:
docker compose logs
This command shows the output generated by the containers. If you want to follow the logs in real time and watch new entries as they appear, add the -f
flag:
docker compose logs -f
Viewing the logs is a practical way to troubleshoot any issues or just keep track of what the server is doing.