keywhiz
keywhiz copied to clipboard
Could not build the image
This is probably not your problem, but it is making it hard for people to test the project.
When building the image with:
docker build --rm --force-rm -t square/keywhiz .
I get:
[INFO] Keywhiz Server 0.10.1-SNAPSHOT ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:12 min
[INFO] Finished at: 2019-08-16T07:26:17Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default) on project keywhiz-model: Communications link failure
[ERROR]
[ERROR] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.: Connection refused (Connection refused)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :keywhiz-model
Removing intermediate container ac698606d086
The command '/bin/sh -c mvn install' returned a non-zero code: 1
I think this is related to the recent changes. We're using the Dockerfile for running some tests in CI. The problem you're seeing happens because the tests that are run during the build step require access to MySQL instance that is expected to be available on localhost:3306
. We run it as such (from .travis.yml
): docker build --network=host -t squareup/keywhiz .
This should really be called Dockerfile-ci
and we should have a separate Dockerfile (or better yet docker compose file) for development purposes.
Thanks for responding @mbyczkowski Yes, I agree that a seperate docker file would make it easier for people new to the project to get up and running.
how to solve?
How do you skip tests when building the Docker image?
I've tried adding several properties to mvn install
(-DskipTests
, -Dmaven.test.skip=true
), as well as adding <maven.test.skip>true</maven.test.skip>
to pom.xml
on line 55.
@torkelrogstad I would have to look more closely, but as I mentioned in my comment above, this Docker build is meant to be used in CI only. We should really rename this to something like Dockerfile.ci
and provide a useable Docker image for dev/deployment purposes.