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

Running the malmo client as a docker container and with the gui enabled #644

Open
prashant-jayan21 opened this issue Dec 16, 2017 · 12 comments

Comments

@prashant-jayan21
Copy link

This is in reference to https://github.com/Microsoft/malmo-challenge/tree/master/docker. Is there a way to run the malmo client as a docker container and at the same time displaying it on the host machine's screen? Basically I don't want to run the client headless but in the usual way (with the gui). I found quite a bit of information on the former but nothing on the latter.

Our use case is using Malmo as a platform for collecting data from users in a certain setting. We need to run the system on a few random users' machines for this purpose and that's why being able to have the gui aspect is important.

I have a Mac machine I'm trying this on and am having a real hard time figuring this out. Any help would be really appreciated!

@tambetm
Copy link

tambetm commented Dec 17, 2017

I think the easiest option is to share X11 socket with the container, as done here:
http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/

@prashant-jayan21
Copy link
Author

@tambetm : Ya I tried that before actually. Didn't work for me. I found and tried a few other solutions from the internet as well but no luck. My guess is it had something to do with me trying this on a mac and not linux. And finally only this worked: https://cntnr.io/running-guis-with-docker-on-mac-os-x-a14df6a76efc. But then I tried this solution for the Malmo docker image but that throws up a different error now.

@DaveyBiggers
Copy link
Member

What's the error you are getting?

@prashant-jayan21
Copy link
Author

Here's the trace I'm looking at:

:runClient
[20:33:36] [main/INFO]: Extra: []
[20:33:36] [main/INFO]: Found and added coremod: com.microsoft.Malmo.OverclockingPlugin
[20:33:37] [main/INFO]: Running with arguments: [--userProperties, {}, --assetsDir, /root/.gradle/caches/minecraft/assets, --assetIndex, 1.11, --accessToken{REDACTED}, --version, 1.11.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[20:33:37] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[20:33:37] [main/INFO]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[20:33:37] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[20:33:37] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[20:33:37] [main/INFO]: Forge Mod Loader version 13.20.0.2228 for Minecraft 1.11.2 loading
[20:33:37] [main/INFO]: Java is OpenJDK 64-Bit Server VM, version 1.8.0_151, running on Linux:amd64:4.9.49-moby, installed at /usr/lib/jvm/java-8-openjdk-amd64/jre
[20:33:37] [main/INFO]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[20:33:37] [main/INFO]: Found a command line coremod : com.microsoft.Malmo.OverclockingPlugin
[20:33:37] [main/WARN]: The coremod com.microsoft.Malmo.OverclockingPlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft
[20:33:37] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[20:33:37] [main/INFO]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[20:33:37] [main/INFO]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[20:33:37] [main/INFO]: Injecting location in coremod com.microsoft.Malmo.OverclockingPlugin
[20:33:37] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[20:33:37] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[20:33:37] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[20:33:37] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[20:33:37] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[20:33:37] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[20:33:37] [main/ERROR]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[20:33:38] [main/ERROR]: FML appears to be missing any signature data. This is not a good thing
[20:33:38] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[20:33:38] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[20:33:38] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[20:33:39] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[20:33:39] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[20:33:39] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[20:33:39] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[20:33:39] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:56]: MALMO: Attempting to transform MinecraftServer
[20:33:39] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:182]: MALMO: Found Minecraft, attempting to transform it
[20:33:39] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:188]: MALMO: Found Minecraft.runGameLoop() method, attempting to transform it
[20:33:39] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:203]: MALMO: Hooked into call to Minecraft.updateDisplay()
[20:33:40] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:42]: net.minecraft.client.entity.EntityPlayerSP
[20:33:40] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:42]: net.minecraft.client.entity.AbstractClientPlayer
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:56]: MALMO: Attempting to transform MinecraftServer
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:118]: MALMO: Found MinecraftServer, attempting to transform it
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:124]: MALMO: Found MinecraftServer.run() method, attempting to transform it
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:132]: MALMO: Transforming LDC
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:132]: MALMO: Transforming LDC
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:132]: MALMO: Transforming LDC
[20:33:40] [Client thread/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockServer:132]: MALMO: Transforming LDC
[20:33:41] [Client thread/INFO]: Setting user: Player826
[20:33:46] [Client thread/WARN]: Skipping bad option: lastServer:
[20:33:46] [Client thread/WARN]: Skipping bad option: streamPreferredServer:
[20:33:46] [Client thread/INFO]: LWJGL Version: 2.9.4
[20:33:46] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:523]: ---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 12/18/17 8:33 PM
Description: Initializing game

java.lang.ExceptionInInitializerError
	at net.minecraft.client.Minecraft.setWindowIcon(Minecraft.java:629)
	at net.minecraft.client.Minecraft.init(Minecraft.java:429)
	at net.minecraft.client.Minecraft.run(Minecraft.java:352)
	at net.minecraft.client.main.Main.main(SourceFile:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
	at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:138)
	... 16 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
	at net.minecraft.client.Minecraft.setWindowIcon(Minecraft.java:629)
	at net.minecraft.client.Minecraft.init(Minecraft.java:429)

-- Initialization --
Details:
Stacktrace:
	at net.minecraft.client.Minecraft.run(Minecraft.java:352)
	at net.minecraft.client.main.Main.main(SourceFile:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
	Minecraft Version: 1.11.2
	Operating System: Linux (amd64) version 4.9.49-moby
	Java Version: 1.8.0_151, Oracle Corporation
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 196777672 bytes (187 MB) / 299368448 bytes (285 MB) up to 1908932608 bytes (1820 MB)
	JVM Flags: 1 total; -Xmx2G
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
OverclockingPlugin (MalmoMod-0.30.0.jar)
  com.microsoft.Malmo.OverclockingClassTransformer
	Launched Version: 1.11.2
	LWJGL: 2.9.4
	OpenGL: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
	GL Caps: 
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'fml,forge'
	Type: Client (map_client.txt)
	Resource Packs: 
	Current Language: ~~ERROR~~ NullPointerException: null
	Profiler Position: N/A (disabled)
	CPU: <unknown>
[20:33:46] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:523]: #@!@# Game crashed! Crash report saved to: #@!@# /root/Malmo/Minecraft/run/./crash-reports/crash-2017-12-18_20.33.46-client.txt
:runClient FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runClient'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 255

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

@prashant-jayan21
Copy link
Author

I did some searching and landed here: LWJGL/lwjgl#129 (comment). This might be the issue? But I'm not entirely sure.

@DaveyBiggers
Copy link
Member

That certainly looks like the issue, thanks for investigating! I've been looking into updating the version of LWJGL Minecraft uses - in fact, we have an issue in about this exact thing (see #642) - it should be possible... I think... will keep you posted.

@prashant-jayan21
Copy link
Author

Awesome. Thanks a lot!

@DaveyBiggers
Copy link
Member

Okay, have been digging. See my comment on #642.
This seems not to be as straightforward as I hoped... The last official release of lwjgl was 2.9.2 - the 2.9.4 version Minecraft uses was presumably built and hosted by them. #642 could be fixed by editing the versions json file to upgrade the OSX version to the 2.9.4 nightly, but it's not so simple in our case.

The simplest option is probably to build lwjgl yourself from source - see here - https://github.com/LWJGL/lwjgl - and then work out where to copy the relevant files - though I've been scratching my head about this too. On Windows, if you download and run Minecraft proper, the files all seem to be kept in C:\Users\username\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl, but because of the labyrinthine complexities of the Forge build setup (deobfuscating/patching/reobfuscating etc) things aren't so clear cut for the modded Minecraft. The lwjgl jar etc can be found in C:\Users\username\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl, but I'm not sure a simple drop-in replacement will work, since the folder structure is somewhat involved. If anyone out there has any clues, please chime in!

The good news is that Minecraft 1.12 made the switch to lwjgl 3, so when we update Malmo to the latest Minecraft, this problem will go away. Hopefully we'll have time to do this in the new year.

@okkhoy
Copy link
Contributor

okkhoy commented Jan 24, 2018

@prashant-jayan21 were you able to get it to run headless without any issues? seems that fails too for me

@AndKram
Copy link
Collaborator

AndKram commented Aug 24, 2018

There is now a VNC enabled docker image that you can use to remotely display Minecraft from a docker container: https://github.com/Microsoft/malmo/blob/master/scripts/python-wheel/README.md

@eambutu
Copy link

eambutu commented Oct 18, 2018

Bump on trying to get malmo work from a docker container in mac? This is the issue that I get:

org.lwjgl.LWJGLException: Could not choose GLX13 config at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method) at org.lwjgl.opengl.LinuxDisplayPeerInfo.<init>(LinuxDisplayPeerInfo.java:61) at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:828) at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61) at org.lwjgl.opengl.Display.create(Display.java:846) at org.lwjgl.opengl.Display.create(Display.java:757) at org.lwjgl.opengl.Display.create(Display.java:739) at net.minecraft.client.Minecraft.createDisplay(Minecraft.java:635) at net.minecraft.client.Minecraft.init(Minecraft.java:469) at net.minecraft.client.Minecraft.run(Minecraft.java:387) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26)

I already tried downgrading my XQuartz, and enabling glx per the instructions: https://www.scm.com/doc/Installation/Remote_GUI.html

@AndKram
Copy link
Collaborator

AndKram commented Oct 18, 2018

We have two example docker builds. One with no visuals (e.g. scripts/docker/build_ubuntu1604_python3.dockerfile using xpra where xpra is started up in build.sh with "xpra start :100; export DISPLAY=100) and a pre build docker image (see https://github.com/Microsoft/malmo/blob/master/scripts/python-wheel/README.md build with scripts/docker/install_console_ubunut1604_python3.dockerfile and console_startup) using VNC that can be viewed in any browser. You could follow these build script / startup script examples. Or just start you docker build with andkram/malmol image).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants