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

The ONLINE_MODE env var is not toggling online-mode

Open securitybryan opened this issue 3 years ago • 3 comments

Describe the problem

Running docker with the environment variable ONLINE_MODE=TRUE seems to be ignored. The example is taken directly from the docs.

docker run -d -p 25565:25565 \
    --name mc6g \
    -e ONLINE_MODE=TRUE \
    -e VERSION=1.19.2 \
    -e EULA=TRUE \
    -e MEMORY=6G -v /opt/minecraft-data:/data itzg/minecraft-server

Here is the log entry which suggests the environment variable is not getting evaluated correctly.

22:28:03] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[22:28:03] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[22:28:03] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[22:28:03] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.

Container definition

docker run -d -p 25565:25565 \
    --name mc6g \
    -e ONLINE_MODE=TRUE \
    -e VERSION=1.19.2 \
    -e EULA=TRUE \
    -e MEMORY=6G -v /opt/minecraft-data:/data itzg/minecraft-server

Container logs

22:28:03] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[22:28:03] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[22:28:03] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[22:28:03] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.

securitybryan avatar Sep 19 '22 03:09 securitybryan

Try adding OVERRIDE_SERVER_PROPERTIES=true since it otherwise doesn't touch server.properties after initial creation.

itzg avatar Sep 19 '22 12:09 itzg

Thank you @itzg !

As an environment variable or a server properties setting?

I may be confused but these are passed in to the environment at the first time an image becomes a running container. Or, does initial creation refer to something else?

securitybryan avatar Sep 19 '22 13:09 securitybryan

As an environment variable

https://github.com/itzg/docker-minecraft-server#server-configuration

itzg avatar Sep 19 '22 16:09 itzg