Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed support for mc-send-to-console #2652

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 23 additions & 7 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,43 @@ 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
| |
+- 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

docker attach mc

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.
2 changes: 2 additions & 0 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ version: '3'
services:
minecraft:
image: itzg/minecraft-server
stdin_open: true
tty: true
ports:
- "25565:25565"
volumes:
Expand Down