mvn docker:build is failing
could you please guide.
I am trying to build this on windows platform.
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.
$ eval $(docker-machine env default) bash: docker-machine: command not found
i am getting this response
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.
yes, docker got installed a fresh update, i will restart and let your know. Thanks again.
the retstart did not help
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?
I am trying to run with a direct Dockerfile present in class path of another project and see if it works.
SS of docker file
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
Step2: run docker image in container, cmd: docker run -p 8080:8080 eazybytes/accounts
docker container runs success in this case
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]
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.
`
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.43.0</version>`
using abvoe plugin worked fine with the latest docker version
@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.