docker-minecraft-bedrock-server icon indicating copy to clipboard operation
docker-minecraft-bedrock-server copied to clipboard

Another Noob Question

Open tofferr opened this issue 5 years ago • 7 comments

Complete Docker noob, and not so good at Minecraft. I did get the docker running on my MacOS desktop. The kids and I are connecting from our iOS devices (though it seems to be a bit unreliable on making the connection), but, none of us are operator. I cannot figure out how to find the server.properties file to edit it, or a command line where I can issue Minecraft commands. Any help would be much appreciated. Thank you.

tofferr avatar May 24 '20 20:05 tofferr

damn os x docker is slow, especially io. as for the rest.

use docker-compose makes life easier create a file inside a folder called bds, name the file docker-compose.yml put this inside

version: '3.4'
services:
  bds:
    container_name: bds
    image: itzg/minecraft-bedrock-server
    environment:
      EULA: "TRUE"
      GAMEMODE: survival
      DIFFICULTY: hard
    ports:
      - 19132:19132/udp
    stdin_open: true
    tty: true

then from the commandline inside that folder do docker-compose up then docker logs bds -f and wait until you see server started, once that happens press ctrl c, then a folder named data should appear inside bds folder, inside that folder edit server.properties, then do docker-compose down inside bds, and start again with docker-compose up -d.

once the server is running to make yourself op, docker attach bds type list enter to test it is working, then op GAMERTAG enter. to dettach do ctrl p q, dont ctrl c cuz it kills the server

IvanTurgenev avatar May 24 '20 20:05 IvanTurgenev

Thanks. Very helpful. I assume this preserves the world state and we wouldn’t lose or in game progress?

tofferr avatar Jun 23 '20 22:06 tofferr

Yes, one very nice benefit of docker compose is that it'll automatically maintain a volume for each declared volume, such as /data. If you want to be extra sure the volume exists as expected, then you can declare the attachment as shown here:

https://github.com/itzg/docker-minecraft-bedrock-server/blob/master/examples/docker-compose.yml#L12-L13

making sure to declare the volume itself:

https://github.com/itzg/docker-minecraft-bedrock-server/blob/master/examples/docker-compose.yml#L17-L18

itzg avatar Jun 23 '20 22:06 itzg

Nice. Will the edited files persist if the image is upgraded?

silverl avatar Jun 24 '20 14:06 silverl

Yep everything in /data gets persisted

itzg avatar Jun 24 '20 17:06 itzg

When I make the docker-compose.yml in bds how does that find my existing docker minecraft world? What if I have 2 worlds and 2 different ports in docker?

I did follow directions. The docker-compose up resulted in:

Starting bds ... done
Attaching to bds
bds    | DEBU[0000] Using /data to match uid and gid             
bds    | DEBU[0000] Resolved UID=0 from match path               
bds    | DEBU[0000] Resolved GID=0 from match path               
bds    | Downloading Bedrock server version 1.16.1.02 ...
bds    | 2020/07/03 15:14:23 Setting difficulty to hard in server.properties
bds    | Starting Bedrock server...
bds    | NO LOG FILE! - setting up server logging...
bds    | [2020-07-03 15:14:23 INFO] Starting Server
bds    | [2020-07-03 15:14:23 INFO] Version 1.16.1.2
bds    | [2020-07-03 15:14:23 INFO] Session ID 10f30544-8647-4ec2-b7ee-e6e6a5611e10
bds    | [2020-07-03 15:14:23 INFO] Level Name: Bedrock level
bds    | [2020-07-03 15:14:23 INFO] Game mode: 0 Survival
bds    | [2020-07-03 15:14:23 INFO] Difficulty: 3 HARD
bds    | [2020-07-03 15:14:23 INFO] opening worlds/Bedrock level/db
bds    | [2020-07-03 15:14:26 INFO] IPv4 supported, port: 19132
bds    | [2020-07-03 15:14:26 INFO] IPv6 not supported
bds    | [2020-07-03 15:14:26 INFO] IPv4 supported, port: 34962
bds    | [2020-07-03 15:14:26 INFO] IPv6 not supported
bds    | [2020-07-03 15:14:27 INFO] Server started.

But it did not return a command line to issue docker logs bds -f... it seemed that it was just going to be a perpetual server running. Did I miss something?

Thanks so much!

Chris

tofferr avatar Jul 03 '20 15:07 tofferr

@tofferr the way you do that with containers in general is by attaching a host directory as a volume. In this case, the target path is /data. With docker compose you use the volumes: attribute:

https://docs.docker.com/compose/compose-file/#short-syntax-3

where the left hand side will be a relative or absolute path to a data directory that contains a worlds directory. In turn the LEVEL_NAME is used by the server to determine the specific worlds subdirectory used.

As for multiple ports, the Bedrock server is really finicky about multiple ports or it might be Docker itself. This example worked for me on Ubuntu but not Docker Desktop on Windows:

https://github.com/itzg/docker-minecraft-bedrock-server/issues/77#issuecomment-653189141

itzg avatar Jul 04 '20 20:07 itzg