Search code examples
dockerdocker-composeyaml

Add Icon Variable to docker-compose.yml for Minecraft Server Container


I'm trying to setup a Docker Minecraft Server with itzg's minecraft-server. The first attempt worked great and I already played a little.

Setup

Now I want to upgrade the visuals with a server icon. I'm using docker-compose (file name "docker-compose.yml") to spin up the container which looks like this:


services:
    minecraft:
        # which image you want to pull (you may add :latest)
        image: itzg/minecraft-server
        container_name: minecraft-server
        # mount the data container to a accessable file
        volumes:
            - ~/Documents/docker/Minecraft:/data
        ports:
            - 25565:25565
        environment:
            # neccessary
            EULA: "TRUE"
            # recomended
            OPS: "duxt3r__"
            ENABLE_WHITELIST: "TRUE"
            ENFORCE_WHITELIST: "TRUE"
            MEMORY: "4G"
            # optional
            VERSION: "1.20.2"
            TYPE: "BUKKIT"
            MOTD: "\u00A7lVersion \u00A76[1.20.2] \u00A70--- !SURVIVAL! --- Version \u00A7a0.2 \u00A77patch:RAM=4GB, Cosmetics\u00A7r\n(server is currently in ALPHA version)"
            MAX_PLAYERS: 10
            ICON: ~/Documents/docker/Minecraft/server-icon.png
            
        tty: true
        stdin_open: true
        # try restarting 3 times if container fails
        restart: on-failure:3

Problem

When I try to start the server with sudo docker-compose up -d the Portainer console outputs

[init] ERROR: /home/ubuntu/Documents/docker/Minecraft/server-icon.png does not appear to be a URL or existing file

Can anyone explain to me what I do wrong and provide a Solution?

I have tried...

  1. ... changing the filename to "server-icon.png" cause in the server files it's supposed to be named like this and check the image dimensions. But this shouldn't make any difference since the documentation states (under "ICON") that the file is automatically "scaled, and converted to the proper format".

  2. ...different paths:

~/Documents/docker/Minecraft/server-icon.png
/home/ubuntu/Documents/docker/Minecraft/server-icon.png
home/ubuntu/Documents/docker/Minecraft/server-icon.png
https://home/ubuntu/Documents/docker/Minecraft/server-icon.png
  1. I double checked if the server-icon.png is in the correct location

Solution

  • Within the container, that file exists in the /data/ directory because that's where you mapped the volume to. Try setting the env variable to /data/server-icon.png