Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Could not build the image #493

Open
surfer190 opened this issue Aug 16, 2019 · 5 comments
Open

Could not build the image #493

surfer190 opened this issue Aug 16, 2019 · 5 comments

Comments

@surfer190
Copy link

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
@mbyczkowski
Copy link
Contributor

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.

@surfer190
Copy link
Author

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.

@Z000000
Copy link

Z000000 commented Dec 3, 2019

how to solve?

@torkelrogstad
Copy link

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.

@mbyczkowski
Copy link
Contributor

@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.

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

No branches or pull requests

4 participants