2
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?

More than 1 year has passed since last update.

minecraftJava版のMODサーバーをdockerで構築

Posted at

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

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

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

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

$ exit

再接続し、/opt配下に統合版用のcompose置き場を作成

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

compose作成

$ cd /opt/docker
$ vi compose.yml
----------ここから----------
services:
  java:
    image: itzg/minecraft-server:java8
    container_name: pixelmon(MOD名等)
    restart: always
    environment:
      EULA: "TRUE"
      VERSION: 1.16.5(modに合わせる)
      TYPE: FORGE
      FORGE_VERSION: 36.2.34(modに合わせる
      MEMORY: 3G(スペック次第)
      SERVER_NAME: 任意(hogeサーバ等)
      LEVEL_NAME: pixelmon(MOD名等)
      GAMEMODE: survival
      DIFFICULTY: normal
      TZ: Asia/Tokyo
  ports:
    - 25565:25565/tcp
  volumes:
    - /pixelmon:/data
#lokiにlogを送付する場合のみ設定
  logging:
    driver:loki
    options:
      loki-url:http://192.168.1.x:3100/loki/api/v1/push
volumes:
  pixelmon:
#volumeの場所
#/var/lib/docker/volumes/docker_pixelmon/_data/
----------ここまで----------

docker を起動(forgeのインストール)

$ docker compose up -d

docker を停止してMODの追加

$ docker compose down

下記ディレクトリにforgeがあることを確認
hostname:/var/lib/docker/volumes/docker_pixelmon/_data# ls | grep forge
forge-1.16.5-36.2.34.jar

modディレクトリにMODを格納(wgetで直接downloadか、windowsからwinscp等)
hostname:/var/lib/docker/volumes/docker_pixelmon/_data/mods# ls
Pixelmon-1.16.5-9.1.6-universal.jar

docker を起動

$ docker compose up -d

動作を確認

$ docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS                    PORTS                      NAMES
7df3b1395875   itzg/minecraft-server:java8     "/usr/local/bin/entr…"   15 minutes ago   Up 15 minutes (healthy)   0.0.0.0:25565->25565/tcp   pixelmon

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

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

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

$ docker compose down
$ docker compose up -d
2
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
2
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?