You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,8 +103,6 @@ The [multi-architecture image published at Docker Hub](https://hub.docker.com/re
103
103
The diagram below shows how this `docker-compose.yml` configures two Minecraft server services named `vanilla` and `forge`, which also become the internal network aliases. _Notice those services don't need their ports exposed since the internal networking allows for the inter-container access._
104
104
105
105
```yaml
106
-
version: "3.8"
107
-
108
106
services:
109
107
vanilla:
110
108
image: itzg/minecraft-server
@@ -141,20 +139,21 @@ To test out this example, add these two entries to my "hosts" file:
141
139
142
140
### Using Docker auto-discovery
143
141
144
-
When running `mc-router` in a Docker environment you can pass the `--in-docker` or `--in-docker-swarm`
145
-
command-line argument and it will poll the Docker API periodically to find all the running
146
-
containers/services for Minecraft instances. To enable discovery you have to set the `mc-router.host`
147
-
label on the container. These are the labels scanned:
148
-
149
-
- `mc-router.host`: Used to configure the hostname the Minecraft clients would use to
150
-
connect to the server. The container/service endpoint will be used as the routed backend. You can
151
-
use more than one hostname by splitting it with a comma.
152
-
- `mc-router.port`: This value must be set to the port the Minecraft server is listening on.
153
-
The default value is 25565.
154
-
- `mc-router.default`: Set this to a truthy value to make this server the default backend.
155
-
Please note that `mc-router.host` is still required to be set.
156
-
- `mc-router.network`: Specify the network you are using for the router if multiple are
157
-
present in the container/service. You can either use the network ID, it's full name or an alias.
142
+
When running `mc-router` in a Docker environment you can pass the `--in-docker` or `--in-docker-swarm` command-line argument or set the environment variables `IN_DOCKER` or `IN_DOCKER_SWARM` to "true". With that, it will poll the Docker API periodically to find all the running containers/services for Minecraft instances. To enable discovery, you have to set the `mc-router.host` label on the container.
143
+
144
+
When using in Docker, make sure to volume mount the Docker socket into the container, such as
145
+
146
+
```yaml
147
+
volumes:
148
+
- /var/run/docker.sock:/var/run/docker.sock:ro
149
+
```
150
+
151
+
These are the labels scanned:
152
+
153
+
- `mc-router.host`: Used to configure the hostname the Minecraft clients would use to connect to the server. The container/service endpoint will be used as the routed backend. You can use more than one hostname by splitting it with a comma.
154
+
- `mc-router.port`: This value must be set to the port the Minecraft server is listening on. The default value is 25565.
155
+
- `mc-router.default`: Set this to a truthy value to make this server the default backend. Please note that `mc-router.host` is still required to be set.
156
+
- `mc-router.network`: Specify the network you are using for the router if multiple are present in the container/service. You can either use the network ID, it's full name or an alias.
0 commit comments