-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcloud-config.yml
More file actions
31 lines (27 loc) · 798 Bytes
/
cloud-config.yml
File metadata and controls
31 lines (27 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#cloud-config
users:
- name: minecraftuser
uid: 2000
write_files:
- path: /etc/systemd/system/minecraft.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Docker minecraft container
[Service]
User=minecraftuser
ExecStartPre=/usr/bin/docker-credential-gcr configure-docker
ExecStart=/usr/bin/docker run --name=minecraft -p 25565:25565/udp -p 25565:25565/tcp -v /var/world:${world_path} ${image}
ExecStop=/usr/bin/docker stop minecraft
ExecStopPost=/usr/bin/docker rm minecraft
Restart=on-failure
RestartSec=5s
runcmd:
- mkdir /var/world
- chmod a+rw /var/world
- timedatectl set-timezone ${time_zone}
- shutdown -h ${shutdown_time}
- usermod -a -G docker minecraftuser
- systemctl daemon-reload
- systemctl start minecraft.service