gradle build local works. In docker container it doesn't. WHY?

Viewed 1640

The situation is simple:

here is my local env:

cbongiorno at wa-cbongiorno-mba in /Volumes/dev/sterling/java-user-login-service on master [!$]
$ gradle -v

------------------------------------------------------------
Gradle 4.0
------------------------------------------------------------

Build time:   2017-06-14 15:11:08 UTC
Revision:     316546a5fcb4e2dfe1d6aa0b73a4e09e8cecb5a5

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Mac OS X 10.12.5 x86_64

here is the build command I run:

gradle compileJava check assemble && history | tail -3

here are the results:

BUILD SUCCESSFUL in 3m 3s
38 actionable tasks: 38 executed
 1496  gradle clean
 1497  gradle compileJava check assemble && history | tail -2

Now, when I run this identical arrangement in docker:

docker run --rm gradle:alpine gradle -v

------------------------------------------------------------
Gradle 4.0
------------------------------------------------------------

Build time:   2017-06-14 15:11:08 UTC
Revision:     316546a5fcb4e2dfe1d6aa0b73a4e09e8cecb5a5

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Linux 4.9.36-moby amd64

docker run --rm -v "$PWD":/project -w /project gradle:alpine gradle compileJava check assemble

The tests fail and in the logs I get:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy
build_1  |      at org.redisson.codec.SnappyCodec$2.encode(SnappyCodec.java:68)
build_1  |      at org.redisson.client.handler.CommandEncoder.encode(CommandEncoder.java:103)
build_1  |      at org.redisson.client.handler.CommandEncoder.encode(CommandEncoder.java:45)
build_1  |      at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
build_1  |      ... 31 more
build_1  | 
build_1  | 
build_1  |     io.netty.handler.codec.EncoderException: java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy

When my app attempts to engage with Redis.

How on earth is this possible? Is this a red-herring and the issues is related to the docker environment itself? I would guess an archive is corrupt/wrong but the docker container would pull from the same artifact repositories. So, I don't even know where to start

I used the answer from here to dump the hash values of every jar into a file with:

docker run --rm -v "$PWD":/project -w /project  gradle:alpine gradle printDependencyHashes | sort >  hashes-docker.log

gradle printDependencyHashes | sort > hashes.log

respectively. The results are identical. I even thought about how jar load order from the files system could effect class loading and compared dependencies. Identical. Omitted for brevity.

MD5 hash of all dependencies compared

1 Answers
Related