Repository: itzg/docker-minecraft-server

Issue #2541: Image helper unable to find Forge 1.20.4 installer output
Created: 2023-12-13T18:57:15Z
Describe the problem
Originally reported in Minecraft on Docker Discord and discussed with Forge team.
Changed mc-image-helper to locate the shim jar, but fails with a new problem:
+ exec mc-server-runner --stop-duration 60s --named-pipe /tmp/minecraft-console-in java -Xmx1G -Xms1G -jar forge-1.20.4-49.0.7-shim.jar
Missing required library: net/minecraftforge/forge/1.20.4-49.0.7/forge-1.20.4-49.0.7-client.jar
Exception in thread "main" java.lang.IllegalStateException: Missing required libraries! Check log
	at net.minecraftforge.bootstrap.shim.Main.main(Main.java:53)

Container definition
docker run -it --rm -e EULA=true -e TYPE=FORGE -e VERSION=1.20.4 -e FORGE_VERSION=49.0.7 -e DEBUG=true itzg/minecraft-server

Duplicate issue #2542: Forge is failing to install
Created: 2023-12-14T01:40:01Z
Describe the problem
	at me.itzg.helpers.forge.ForgeInstaller.install(ForgeInstaller.java:215)
	at me.itzg.helpers.forge.ForgeInstaller.install(ForgeInstaller.java:88)
	at me.itzg.helpers.forge.InstallForgeCommand.call(InstallForgeCommand.java:103)
	at me.itzg.helpers.forge.InstallForgeCommand.call(InstallForgeCommand.java:19)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at me.itzg.helpers.McImageHelper.main(McImageHelper.java:157)

Container definition
I don't know how to get the YAML, so this is the JSON I'm using to deploy.
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "containerGroups_documents4_name": {
            "defaultValue": "documents4",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.ContainerInstance/containerGroups",
            "apiVersion": "2023-05-01",
            "name": "[parameters('containerGroups_documents4_name')]",
            "location": "southcentralus",
            "tags": {
                "docker-compose-application": "docker-compose-application"
            },
            "properties": {
                "sku": "Standard",
                "containers": [
                    {
                        "name": "minecraft",
                        "properties": {
                            "image": "itzg/minecraft-server",
                            "ports": [
                                {
                                    "protocol": "TCP",
                                    "port": 25565
                                }
                            ],
                            "environmentVariables": [
                                {
                                    "name": "MEMORY",
                                    "value": "14G"
                                },
                                {
                                    "name": "SE_AIKAR_FLAGS",
                                    "value": "true"
                                },
                                {
                                    "name": "tty",
                                    "value": "true"
                                },
                                {
                                    "name": "stdin_open",
                                    "value": "true"
                                },
                                {
                                    "name": "restart",
                                    "value": "unless-stopped"
                                },
                                {
                                    "name": "EULA",
                                    "value": "TRUE"
                                },
                                {
                                    "name": "MODS_FILE",
                                    "value": "/extras/mods.txt"
                                },
                                {
                                    "name": "TYPE",
                                    "value": "FORGE"
                                }
                            ],
                            "resources": {
                                "requests": {
                                    "memoryInGB": 16,
                                    "cpu": 2
                                },
                                "limits": {
                                    "memoryInGB": 16,
                                    "cpu": 2
                                }
                            },
                            "volumeMounts": [
                                {
                                    "name": "minecraft",
                                    "mountPath": "/data"
                                }
                            ]
                        }
                    }
                ],
                "initContainers": [],
                "restartPolicy": "Always",
                "ipAddress": {
                    "ports": [
                        {
                            "protocol": "TCP",
                            "port": 25565
                        }
                    ],
                    "type": "Public"
                },
                "osType": "Linux",
                "volumes": [
                    {
                        "name": "minecraft",
                        "azureFile": {
                            "shareName": "minecraftdocker",
                            "readOnly": false,
                            "storageAccountName": "minecraftjavastorage",
                            "storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'minecraftjavastorage'), '2019-06-01').keys[0].value]"
                        }
                    }
                ]
            }
        }
    ]
}


Container logs
[init] 2023-12-14 01:33:43+00:00 Changing ownership of /data to 1000 ...
+ export HOME=/data
+ HOME=/data
++ id -u
++ id -g
++ ls -lnd /data
+ log 'Running as uid=1000 gid=1000 with /data as '\''drwxrwxrwx 2 0 0 0 Dec 29  2022 /data'\'''
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-12-14 01:33:51+00:00 Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 2 0 0 0 Dec 29  2022 /data'
+ '[' '!' -e /data/eula.txt ']'
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue true
+ case "${1,,}" in
+ return 0
+ [[ -v RCON_PASSWORD_FILE ]]
+ [[ -v RCON_PASSWORD ]]
++ openssl rand -hex 12
+ RCON_PASSWORD=957456c6248a9a94a9557680
+ export RCON_PASSWORD
+ echo password=957456c6248a9a94a9557680
+ echo 'password: "957456c6248a9a94a9557680"'
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue false
+ case "${1,,}" in
+ return 1
+ [[ -n '' ]]
+ fixJavaPath
+ which java
+ cd /data
+ export DECLARED_TYPE=FORGE
+ DECLARED_TYPE=FORGE
+ export DECLARED_VERSION=LATEST
+ DECLARED_VERSION=LATEST
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue false
+ case "${1,,}" in
+ return 1
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ : ''
+ case "${TYPE^^}" in
+ [[ -n '' ]]
+ log 'Resolving type given FORGE'
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-12-14 01:33:51+00:00 Resolving type given FORGE
+ case "${TYPE^^}" in
+ exec /start-deployForge
+ [[ -n '' ]]
+ mc-image-helper install-forge --output-directory=/data --results-file=/data/.run-forge.env --minecraft-version=LATEST --forge-version=RECOMMENDED --force-reinstall=false
[mc-image-helper] 01:33:57.362 DEBUG : JSON FETCH: uri=https://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json headers=[user-agent: itzg/mc-image-helper/1.37.3 (cmd=install-forge), x-fetch-session: e7c73ca2-6795-4c19-bf29-53b2bdd2aa03, accept: application/json, host: files.minecraftforge.net]
[mc-image-helper] 01:33:57.594 DEBUG : JSON FETCH: uri=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json headers=[user-agent: itzg/mc-image-helper/1.37.3 (cmd=install-forge), x-fetch-session: e7c73ca2-6795-4c19-bf29-53b2bdd2aa03, accept: application/json, host: files.minecraftforge.net]
[mc-image-helper] 01:33:57.741 DEBUG : Narrowed forge versions to {latest=49.0.9} and looking for recommended
[mc-image-helper] 01:33:57.743 DEBUG : Resolved installer version=VersionPair(minecraft=1.20.4, forge=49.0.9)
[mc-image-helper] 01:33:57.744 INFO  : Downloading Forge installer 49.0.9 for Minecraft 1.20.4
[mc-image-helper] 01:33:58.036 DEBUG : FILE FETCH: uri=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.0.9/forge-1.20.4-49.0.9-installer.jar headers=[user-agent: itzg/mc-image-helper/1.37.3 (cmd=install-forge), x-fetch-session: e7c73ca2-6795-4c19-bf29-53b2bdd2aa03, accept: application/java-archive, host: maven.minecraftforge.net]
[mc-image-helper] 01:33:58.840 DEBUG : Download of https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.4-49.0.9/forge-1.20.4-49.0.9-installer.jar took 1s 71ms at 5111 KB/s
[mc-image-helper] 01:33:58.845 INFO  : Running Forge installer. This might take a while...
[mc-image-helper] 01:34:14.767 DEBUG : Deleting Forge installer log at /data/forge-installer-1.20.4-49.0.9.jar.log
[mc-image-helper] 01:34:14.794 ERROR : 'install-forge' command failed. Version is 1.37.3
me.itzg.helpers.errors.GenericException: Unable to locate forge server jar
	at me.itzg.helpers.forge.ForgeInstaller.install(ForgeInstaller.java:215)
	at me.itzg.helpers.forge.ForgeInstaller.install(ForgeInstaller.java:88)
	at me.itzg.helpers.forge.InstallForgeCommand.call(InstallForgeCommand.java:103)
	at me.itzg.helpers.forge.InstallForgeCommand.call(InstallForgeCommand.java:19)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at me.itzg.helpers.McImageHelper.main(McImageHelper.java:157)
+ log 'ERROR failed to install Forge'
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-12-14 01:34:15+00:00 ERROR failed to install Forge
+ exit 1

Closing comment (2023-12-14T01:53:32Z): Thanks for reportng this. Yes, it is indeed a duplicate of #2541. I'll have a fix out shortly.