emcniece / DockerYourXyzzy

Dockerized Cards Against Humanity clone - https://github.com/ajanata/PretendYoureXyzzy
71 stars 38 forks source link

Unable to use locally built image #1

Open XenHat opened 6 years ago

XenHat commented 6 years ago

Hello, thank you for posting this.

However I cannot run the container I have built (using a PYX fork with some modifications).

Most of the time, I get this error: standard_init_linux.go:190: exec user process caused "no such file or directory" which doesn't feel very useful in telling me what's wrong.

At best, I can run something, built using docker build -t <tag> ., but all I get is a blank page on both the welcome and the game.jsp pages. I also had to edit the dockerfile to point to davidcaste/alpine-tomcat:jre8tomcat7 as jre1tomcat7 is not a valid tag at the moment.

What am I doing wrong?

P.S. using the prebuilt, hosted image works fine. See below.

emcniece commented 6 years ago

That first standard_init_linux.go:190: exec user process... error usually happens when Docker containers are run on a platform other than the one they were built on. I have built these images on MacOS, so I might guess that you're encountering this on Windows - is that correct? We may have to look at cross-compilation and pushing architecture-specific images to Docker hub.

Sounds like you're on the right track with building it locally! You should be able to build the dev image (via docker build -t <tag> --target dev) and create a functional image. Note the --target dev here: this is important as the Dockerfile is multi-stage and will build the entire Dockerfile unless otherwise specified. Building the full (or "runtime") image might not be desired as you want to debug this stack right now, so try --target dev.

Lastly, where did jre1tomcat7 come from? I don't see that in the repo, did I make a typo somewhere? That should definitely be jre8tomcat7.

Give the docker build -t <tag> --target dev a shot and see if it comes up. It can take a few minutes to build after you execute docker run ... so watch the logs on that container. Also look at overrides/build.properties and make sure that the hibernate.* defs are using the SQLite block and not the Postgres options - this should simplify the debug process.

XenHat commented 6 years ago

Hi, thank you for replying. I cannot find jre1 either, that might have been an accidental change on my end. I have numpad bound to my mouse, haha..

I had no success using the dev target before posting the issue but I'll give it another shot today and see what I can find out and what info I can relay back

XenHat commented 6 years ago

Should I be worried about this test failing?

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running net.socialgamer.cah.util.ChatFilterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.113 sec
Running net.socialgamer.cah.data.GameTest
log4j:WARN No appenders could be found for logger (net.sf.uadetector.internal.data.DataBuilder).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.617 sec
Running net.socialgamer.cah.data.GameManagerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.368 sec
Running net.socialgamer.cah.ConstantsTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec

Here's the output after a full rebuild and run:

Removing intermediate container 7047409e53f7
 ---> fd60b450c3ce
Successfully built fd60b450c3ce
Successfully tagged pyx-new-test:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
PS D:\code\apps\pyx-docker> docker run pyx-new-test
standard_init_linux.go:190: exec user process caused "no such file or directory"
PS D:\code\apps\pyx-docker>
emcniece commented 6 years ago

Woah, thanks for the logs. The tests are fine, that's related to the codebase and is outside the scope of this repo.

The standard_init_linux.go:190: exec user process caused error is again the result of something in this Docker image that is incompatible with the platform architecture. We'll need to figure out which of these pieces isn't compatible.

What OS are you using? Are you building and deploying on the same OS?

XenHat commented 6 years ago

I am building on Windows 10 x86_64, and deploying on Docker for Windows, using Linux-based containers, on the same machine.

The dockerhub-provided image (from yours) is working fine, but I needed to add some card sets so I need to build my own. So it's not entirely incompatible, I think. Probably some recent change?

XenHat commented 6 years ago

@emcniece Any progress? I have a community event planned and I need this to work. We'll have to use something else for now but I still am interested in getting this to work.

More info if you need them:

image image I do have a haswell laptop running Linux I can try to build the image on as well.

emcniece commented 6 years ago

Apologies, no progress debugging this yet. Perhaps this weekend.

Have you looked at adding custom cards through Cardcast? I can confirm that this works, but I didn't build my own deck.

That... is quite the machine you have there.

XenHat commented 6 years ago

I'll give that a try in the meantime, thanks!

That... is quite the machine you have there.

I game, stream, and develop software. It's barely enough power! hahaha.

XenHat commented 6 years ago

Update: I have spent some more time investigating. the release mode container does not work either. I have to use dev mode image

EDIT: Not shown:

docker run --name="xyzzy" -d -p 777:8080 emcniece/dockeryourxyzzy:run
docker run -d -p 666:8080 --name pyx-dev emcniece/dockeryourxyzzy:dev
emcniece commented 6 years ago

Thank you so much for the detailed reports! Sorry this isn't in a more functional state right now.

XenHat commented 6 years ago

No worries, I hope we can figure this together.

XenHat commented 6 years ago

Building a local container with dev as the target also produces a non-working product. Or perhaps I don't understand how to use the built product?

Build log: https://gist.github.com/59dc8f14be819b0afe2b77619cd6fa3d

XenHat commented 5 years ago

hey @emcniece have you been able to make progress on this yet? I really don't want to run the code directly on my machine...

emcniece commented 5 years ago

Ah, I haven't yet, sorry. BUT I have a week off starting tomorrow - I'll prioritize this and report back asap!

emcniece commented 5 years ago

Update: trying to provision a Windows machine to test on. I haven't forgotten about this!

emcniece commented 5 years ago

From another user:

Having the same issue on a raspi zero w. It looks to me like there is some issue with the alpine linux base image to me. Every image after that has some trouble with installing the apk packages.

Yes, the base docker image needs to be built for the destination platform for each container along the way. This is problematic though as this repo inherits a number of images:

Each of these images needs to be built for the desired platform, then they all need to inherit the previous image for the same platform. They're all built for a Linux target right now, and they need to be switched to ARM or Windows.

The very base Alpine image has an option for ARM, but I haven't figured out if it's possible to build for Windows yet.

The irony of this Java application being extremely difficult to compile for cross-platform operation is not lost on me.

emcniece commented 4 years ago

Hello again, 2 years later. I've just pushed emcniece/dockeryourxyzzy:3 which fixes some Docker image problems. No clue if it will work on Windows, and I'm not sure what kind of Docker VM progress has been made since 2018. Just thought I'd give you a shout in case you had any interest 👍

XenHat commented 4 years ago

Hey, thank you! in a weird twist of fate, i've moved away from windows as my main operating system. I do have a windows machine around able to test this, however, I will try to find time soon :)

cprosser commented 4 years ago

I just encountered this error on Windows with Docker/WSL2. Ends up it a crlf conversion issue. There's probably a better way of fixing this, but this works.

Running the following and then grabbing a fresh clone of the repo got it all working for me.

git config --global core.eol lf
git config --global core.autocrlf input

git clone https://github.com/emcniece/DockerYourXyzzy.git 

https://stackoverflow.com/questions/51508150/standard-init-linux-go190-exec-user-process-caused-no-such-file-or-directory

Afterward you can restore git to normal windows behavior with:

git config --global --unset core.autocrlf
git config --global --unset core.eol
emcniece commented 4 years ago

@cprosser I've just merged your PR with the dos2unix feature. Do you think that will solve this issue?

cprosser commented 4 years ago

@emcniece it definitely fixed the issue for me!