# Docker-machine executable was not found on PATH while building a java quarkus app (cimg/openjdk:17.0)

**URL:** <https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858>\
**Category:** CircleCI Images\
**Tags:** java, cimg, docker\
**Created:** [April 28, 2022, 11:54am UTC](https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858 "2022-04-28T11:54:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ginccc](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ginccc/32/30010_2.png) [@ginccc](https://discuss.circleci.com/u/ginccc)\
**Post date:** [April 28, 2022, 11:54am UTC](https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858/1 "2022-04-28T11:54:39Z")

</div>

Hi there!

I am trying to get a java quarkus app build, which in turn builds a docker image.  
I would like to use the circleci image “cimg/openjdk:17.0” for this as it seems to check all the boxes in terms of software installed (java 17, maven 3.8.5, docker).

The build however fails when the quarkus java build tries to find/access docker in order to build the docker image itself:

```auto
[WARNING] Attempted to read Testcontainers configuration file at file:/home/circleci/.testcontainers.properties but the file was not found. Exception message: FileNotFoundException: /home/circleci/.testcontainers.properties (No such file or directory)
[INFO] docker-machine executable was not found on PATH ([/opt/sbt/bin, /opt/gradle/bin, /opt/apache-maven/bin, /home/circleci/bin, /home/circleci/.local/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin])
[ERROR] Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
[ERROR] UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
[ERROR] As no valid configuration was found, execution cannot continue
[WARNING] [io.quarkus.deployment.IsDockerWorking] Could not determine version of Docker daemon

```

[https://app.circleci.com/pipelines/github/labsai/EDDI/457/workflows/e8270184-82ef-4748-974a-fe8d4bfa4309/jobs/1344](https://app.circleci.com/pipelines/github/labsai/EDDI/457/workflows/e8270184-82ef-4748-974a-fe8d4bfa4309/jobs/1344)

This is my circleci script in use:

```auto
version: 2
jobs:
  build:
    docker:
      - image: cimg/openjdk:17.0
    working_directory: ~/repo
    environment:
      MAVEN_OPTS: -Xmx6400m
    steps:
      ## Checkout the source code
      - checkout

      ## Restore any files that may have been cached from previous jobs
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "pom.xml" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      ## cache the dependencies
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

      - run:
          name: Set permissions
          command: chmod +x mvnw

      - run:
          name: Run unit tests
          command: ./mvnw test

      - run:
          name: Build docker image
          command: ./mvnw package '-Dquarkus.container-image.build=true'

```

Anyone an idea how to fix this?

---

<div class="post-metadata">

**Author:** ![FelicianoTech](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/felicianotech/32/21348_2.png) [@FelicianoTech](https://discuss.circleci.com/u/FelicianoTech)\
**Post date:** [April 29, 2022, 2:52pm UTC](https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858/2 "2022-04-29T14:52:25Z")

</div>

In order to use Docker with the Docker executor, the special step `setup_remote_docker` needs to be used. So it can look like this:

```yaml
version: 2
jobs:
  build:
    docker:
      - image: cimg/openjdk:17.0
    working_directory: ~/repo
    environment:
      MAVEN_OPTS: -Xmx6400m
    steps:
      ## Checkout the source code
      - checkout

      ## Restore any files that may have been cached from previous jobs
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "pom.xml" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      ## cache the dependencies
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

      - run:
          name: Set permissions
          command: chmod +x mvnw

      - setup_remote_docker:
          version: 20.10.12

      - run:
          name: Run unit tests
          command: ./mvnw test

      - run:
          name: Build docker image
          command: ./mvnw package '-Dquarkus.container-image.build=true'

```

That will allow you to use the local Docker client to connect to a Docker engine. I don’t believe Docker machine is installed though. If that’s what you need, you will need to install it.

Lastly, maybe this is just an example here but with the config you shared, dependencies won’t be cached because they are not pulled/downloaded before saving.

---

<div class="post-metadata">

**Author:** ![ginccc](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/ginccc/32/30010_2.png) [@ginccc](https://discuss.circleci.com/u/ginccc)\
**Post date:** [April 29, 2022, 4:17pm UTC](https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858/3 "2022-04-29T16:17:14Z")

</div>

Awesome, setup\_remote\_docker worked like you have suggested. Docker is installed on this image. And also thanks for the hint with the cache!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [May 9, 2022, 4:17pm UTC](https://discuss.circleci.com/t/docker-machine-executable-was-not-found-on-path-while-building-a-java-quarkus-app-cimg-openjdk-17-0/43858/4 "2022-05-09T16:17:27Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
