3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

minecraft統合版のサーバーをdockerで構築

Last updated at Posted at 2022-08-10

docker-ceとdocker-compose-pluginをインストール
(ほかの記事に任せます)

一般ユーザでdockerを実行できるようにする

$ sudo usermod -G docker hoge
$ sudo cat /etc/group | grep docker
docker:x:993:hoge

上記設定反映のために一度切断

$ exit

再接続し、loki-driverをインストール

$ docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
latest: Pulling from grafana/loki-docker-driver

/opt配下に統合版用のcompose置き場を作成

$ sudo mkdir /opt/docker
$ sudo chown hoge:hoge /opt/docker

compose作成

$ cd /opt/docker
$ vi compose.yml
----------ここから----------
services:
  minecraft:
    image: itzg/minecraft-bedrock-server
    container_name: minecraft
    environment:
      EULA: TRUE
      SERVER_NAME: 任意(hogeサーバ等)
      LEVEL_NAME: 任意(yyyy-mm-dd等)
      GAMEMODE: survival
      FORCE_GAMEMODE: true
      DIFFICULTY: normal
      ALLOW_CHEATS: true
      ALLOW_LIST: false 
      ONLINE_MODE: true
      TZ: Asia/Tokyo
    ports:
      - 19132:19132/udp
    volumes:
      - /minecraft:/data
    stdin_open: true
    tty: true
    logging:
      driver:loki
      options:
        loki-url:http://192.168.1.x:3100/loki/api/v1/push

  loki:
    image: grafana/loki:latest
    container_name: loki
    ports:
      - 3100:3100

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - 3000:3000
    volumes:
      - grafana:/var/lib/grafana

volumes:
  minecraft:
  grafana:
#volumeの場所
#/var/lib/docker/volumes/
----------ここまで----------

docker を起動

$ docker compose up -d

動作を確認

$ docker compose ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED          STATUS                    PORTS                      NAMES
73c49f8ce89d   itzg/minecraft-bedrock-server   "/usr/local/bin/entr…"   22 seconds ago   Up 22 seconds (healthy)   0.0.0.0:19132->19132/udp   minecraft
0e8493f158e6   grafana/grafana:latest          "/run.sh"                22 seconds ago   Up 22 seconds             0.0.0.0:3000->3000/tcp     grafana
f785179953c3   grafana/loki:latest             "/usr/bin/loki -conf…"   22 seconds ago   Up 22 seconds             0.0.0.0:3100->3100/tcp     loki

子供向けのサーバチューニング(お好みで)

$ docker attach bedrock_server #アタッチコマンド
gamerule showCoordinates true #座標を表示
gamerule pvp false #味方へのダメージ無効
gamerule keepInventory true #死亡時にアイテムを落とさない
Ctrl+P → Ctrl+Q #タッチコマンド

サーバのバージョンアップ

$ docker compose down
$ docker compose up -d
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?