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

mvn docker:build is failing #20

Open
sandeep-sparrow opened this issue Jul 15, 2023 · 13 comments
Open

mvn docker:build is failing #20

sandeep-sparrow opened this issue Jul 15, 2023 · 13 comments

Comments

@sandeep-sparrow
Copy link

could you please guide.

image
@sandeep-sparrow
Copy link
Author

I am trying to build this on windows platform.

@sharmasourabh
Copy link
Collaborator

It looks like either the docker is not installed properly,or the shell you are running the maven build can't recognise the docker environment.

You may want to execute the following command in same shell you are running the build: eval "$(docker-machine env default)" if docker is installed properly.
Then, try running the build again.

@sandeep-sparrow
Copy link
Author

$ eval $(docker-machine env default)
bash: docker-machine: command not found

i am getting this response

@sharmasourabh
Copy link
Collaborator

It means you must be using the latest Docker. docker-machine is deprecated in 2021.

Are you able to run any docker container locally and still facing issue while running the build in same shell? If you have installed Docker recently, you may want to restart your machine if you haven't.

@sandeep-sparrow
Copy link
Author

yes, docker got installed a fresh update, i will restart and let your know. Thanks again.

@sandeep-sparrow
Copy link
Author

the retstart did not help

@sharmasourabh
Copy link
Collaborator

Did you try running any container in same shell and did it work? Could you please post the output with command here?

Also, did you set the DOCKER_HOST variable with correct daemon path?

@sandeep-sparrow
Copy link
Author

I am trying to run with a direct Dockerfile present in class path of another project and see if it works.

@sandeep-sparrow
Copy link
Author

SS of docker file

image

contents of Dockerfile

`#Start with a base image containing Java runtime
FROM openjdk:17-slim as build

MAINTAINER eazybytes.com

Add the application's jar to the container

COPY target/accounts-0.0.1-SNAPSHOT.jar accounts-0.0.1-SNAPSHOT.jar

Execute the application

ENTRYPOINT ["java","-jar","/accounts-0.0.1-SNAPSHOT.jar"]`

Step1: created docker image cmd: docker build . -t eazybytes/accounts

docker image created successfully

image

Step2: run docker image in container, cmd: docker run -p 8080:8080 eazybytes/accounts

docker container runs success in this case

@sandeep-sparrow
Copy link
Author

image

when running the mvn docker:build command for dynamic creation of DockerFile, following error is encountered.

[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.13.9:build (default-cli) on project restaurant-service: Execution default-cli of goal org.jolokia:docker-maven-plugin:0.13.9:build failed: No url given, no DOCKER_HOST environment variable and no read/writable '/var/run/docker.sock' -> [Help 1]

@sharmasourabh
Copy link
Collaborator

sharmasourabh commented Jul 17, 2023

It seems, plugin docker-maven-plugin's version (0.13.9) doesn't support the latest Docker. You may want to update the plugin.

Latest version can be found at https://github.com/fabric8io/docker-maven-plugin, you may want to refer its user manual for the changes.

@sandeep-sparrow
Copy link
Author

sandeep-sparrow commented Jul 17, 2023

`

    <groupId>io.fabric8</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.43.0</version>`

using abvoe plugin worked fine with the latest docker version

@sandeep-sparrow
Copy link
Author

@sharmasourabh can you please add me as collab on dev branch will checkin the latest maven-docker-plugin for user's having latest docker version installed on their system.

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

No branches or pull requests

2 participants