From ac7bf437ca23c270963a1276d98f21d7d177b043 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 10 Feb 2024 13:24:06 -0600 Subject: [PATCH] Fixed support for mc-send-to-console (#2652) --- Dockerfile | 2 +- docs/commands.md | 30 +++++++++++++++++++++++------- examples/docker-compose.yml | 2 ++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index da2653e905a..b3c420f2a7e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_SERVER_RUNNER_VERSION=1.11.0 +ARG MC_SERVER_RUNNER_VERSION=1.11.1 RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz diff --git a/docs/commands.md b/docs/commands.md index ed7b44c3ca4..1eccf1e8e3e 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -19,7 +19,9 @@ docker exec mc rcon-cli stop _The `-i` is not needed in this case._ -If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script. For example, a player can be op'ed in the container `mc` with: +## When RCON is disabled + +If rcon is disabled you can send commands by passing them as arguments to the packaged `mc-send-to-console` script after setting the env var `CREATE_CONSOLE_IN_PIPE` to "true". For example, a player can be op'ed in the container `mc` with: ```shell docker exec mc mc-send-to-console op player @@ -27,9 +29,26 @@ docker exec mc mc-send-to-console op player +- container name +- Minecraft commands start here ``` -In order to attach and interact with the Minecraft server, add `-it` when starting the container, such as +## Enabling interactive console + +In order to attach and interact with the Minecraft server make sure to enable TTY and keep stdin open. + +!!! example + + With `docker run` use the `-it` arguments: + ```shell docker run -d -it -p 25565:25565 --name mc itzg/minecraft-server + ``` + + or with a compose file: + + ```yaml + services: + minecraft: + stdin_open: true + tty: true + ``` With that you can attach and interact at any time using @@ -37,9 +56,6 @@ With that you can attach and interact at any time using and then Control-p Control-q to **detach**. -For remote access, configure your Docker daemon to use a `tcp` socket (such as `-H tcp://0.0.0.0:2375`) -and attach from another machine: - - docker -H $HOST:2375 attach mc +!!! info "RCON is required for fully interactive, color console" -Unless you're on a home/private LAN, you should [enable TLS access](https://docs.docker.com/articles/https/). + RCON must be enabled, which is the default, in order to use a fully interactive console with auto-completion and colorized log output. \ No newline at end of file diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml index fd2701916a6..5d856cd192a 100644 --- a/examples/docker-compose.yml +++ b/examples/docker-compose.yml @@ -4,6 +4,8 @@ version: '3' services: minecraft: image: itzg/minecraft-server + stdin_open: true + tty: true ports: - "25565:25565" volumes: