Skip to content

Commit 777f4e2

Browse files
authored
Lazymc - Update misc examples with non-deprecated method of managing lazymc (#3360)
1 parent 21f2a7e commit 777f4e2

File tree

2 files changed

+67
-15
lines changed

2 files changed

+67
-15
lines changed

docs/misc/examples.md

+34-8
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,33 @@ services:
3131
With [lazymc-docker-proxy](https://github.com/joesturge/lazymc-docker-proxy) you are able to use [lazymc](https://github.com/timvisee/lazymc) with the minecraft container.
3232
3333
```yaml
34+
# Lazymc requires that the minecraft server have a static IP.
35+
#
36+
# To ensure that our servers have a static IP we need to create
37+
# a network for our services to use.
38+
#
39+
# By default, Docker uses 172.17.0.0/16 subnet range.
40+
# So we need to create a new network in a different subnet
41+
# See the readme for more information.
42+
#
43+
# Please ensure that the subnet falls within the private CIDRs:
44+
# https://datatracker.ietf.org/doc/html/rfc1918#section-3
45+
#
46+
# And that it is not in use by anything else.
47+
networks:
48+
minecraft-network:
49+
driver: bridge
50+
ipam:
51+
config:
52+
- subnet: 172.18.0.0/16
53+
3454
services:
3555
lazymc:
36-
container_name: lazymc
3756
image: ghcr.io/joesturge/lazymc-docker-proxy:latest
38-
environment:
39-
# Point to the service name of the Minecraft server
40-
SERVER_ADDRESS: mc:25565
41-
# Required to find the container to manage it
42-
LAZYMC_GROUP: mc
57+
# the IPs should start at .2 as .1 is reserved for the gateway
58+
networks:
59+
minecraft-network:
60+
ipv4_address: 172.18.0.2
4361
restart: unless-stopped
4462
volumes:
4563
# you should mount the minecraft server dir under /server, using read only.
@@ -54,11 +72,19 @@ services:
5472
# Standard Docker Minecraft server, also works with other server types
5573
mc:
5674
image: itzg/minecraft-server:java21
57-
container_name: minecraft-server
75+
# Assign a static IP to the server container
76+
networks:
77+
minecraft-network:
78+
ipv4_address: 172.18.0.3
5879
# We need to add a label here so that lazymc-docker-proxy knows which
5980
# container to manage
6081
labels:
82+
# Set lazymc.enabled to true to enable lazymc on this container
83+
- lazymc.enabled=true
84+
# Required to find the container to manage it
6185
- lazymc.group=mc
86+
# Point to the service name of the Minecraft server
87+
- lazymc.server.address=mc:25565
6288
tty: true
6389
stdin_open: true
6490
# This container should be managed solely by the lazymc container
@@ -113,4 +139,4 @@ services:
113139
stdin_open: true
114140
restart: unless-stopped
115141
```
116-
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/lazytainer/docker-compose.yml)
142+
[Source](https://github.com/itzg/docker-minecraft-server/blob/master/examples/lazytainer/docker-compose.yml)

examples/lazymc/docker_compose.yml

+33-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1+
# Lazymc requires that the minecraft server have a static IP.
2+
#
3+
# To ensure that our servers have a static IP we need to create
4+
# a network for our services to use.
5+
#
6+
# By default, Docker uses 172.17.0.0/16 subnet range.
7+
# So we need to create a new network in a different subnet
8+
# See the readme for more information.
9+
#
10+
# Please ensure that the subnet falls within the private CIDRs:
11+
# https://datatracker.ietf.org/doc/html/rfc1918#section-3
12+
#
13+
# And that it is not in use by anything else.
14+
networks:
15+
minecraft-network:
16+
driver: bridge
17+
ipam:
18+
config:
19+
- subnet: 172.18.0.0/16
20+
121
services:
222
lazymc:
3-
container_name: lazymc
423
image: ghcr.io/joesturge/lazymc-docker-proxy:latest
5-
environment:
6-
# Point to the service name of the Minecraft server
7-
SERVER_ADDRESS: mc:25565
8-
# Required to find the container to manage it
9-
LAZYMC_GROUP: mc
24+
# the IPs should start at .2 as .1 is reserved for the gateway
25+
networks:
26+
minecraft-network:
27+
ipv4_address: 172.18.0.2
1028
restart: unless-stopped
1129
volumes:
1230
# you should mount the minecraft server dir under /server, using read only.
@@ -21,11 +39,19 @@ services:
2139
# Standard Docker Minecraft server, also works with other server types
2240
mc:
2341
image: itzg/minecraft-server:java21
24-
container_name: minecraft-server
42+
# Assign a static IP to the server container
43+
networks:
44+
minecraft-network:
45+
ipv4_address: 172.18.0.3
2546
# We need to add a label here so that lazymc-docker-proxy knows which
2647
# container to manage
2748
labels:
49+
# Set lazymc.enabled to true to enable lazymc on this container
50+
- lazymc.enabled=true
51+
# Required to find the container to manage it
2852
- lazymc.group=mc
53+
# Point to the service name of the Minecraft server
54+
- lazymc.server.address=mc:25565
2955
tty: true
3056
stdin_open: true
3157
# This container should be managed solely by the lazymc container

0 commit comments

Comments
 (0)