简体   繁体   中英

exec: "com.docker.cli": executable file not found in $PATH

I am getting this error when docker-compose up on one of the containers only.

exec: "com.docker.cli": executable file not found in $PATH
The terminal process "/bin/zsh '-c', 'docker logs -f f6557b5dd19d9b2bc5a63a840464bc2b879d375fe72bc037d82a5358d4913119'" failed to launch (exit code: 1).
  1. I uninstalled and reinstalled docker desktop@2.3.0.5 on Mac
  2. docker-compose build from scratch
  3. other containers are running
  4. I get the above error.
  5. It used to be running. I am not sure why this is happening. I know that I upgraded docker from I think 2.3
  6. also I think I received an update on my mac

Dockerfile

FROM tiangolo/uvicorn-gunicorn:python3.8
COPY requirements.txt /app/
RUN pip install -r requirements.txt

COPY ./app /app/app
#COPY config.py /app/app/

docker-compose.yml

version: "3"

services:
    postgresql:
        container_name: postgresql
        image: postgres:12
        ports:
            - "5433:5432"
        environment:
            - POSTGRES_USER=${POSTGRES_USER}
            - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
            - POSTGRES_DB=${POSTGRES_DB}
        volumes:
            - ./postgres-data:/var/lib/postgresql/data
    fastapi:
        build:
            context: ./fastapi/
            dockerfile: Dockerfile
        volumes:
            - ./fastapi/app/imgs:/app/app/imgs
        ports:
            - "1001:80"
        depends_on:
            - postgresql
        env_file:
            - .env
    pgadmin:
        container_name: pgadmin
        image: dpage/pgadmin4
        environment:
            - PGADMIN_DEFAULT_EMAIL=pgadmin4@pgadmin.org
            - PGADMIN_DEFAULT_PASSWORD=admin
        ports:
            - "5050:80"
        depends_on:
            - postgresql

    solr:
        build:
            context: ./solr/
            dockerfile: Dockerfile
        restart: always
        ports:
            - "8983:8983"
        volumes:
            - data:/var/solr
volumes:
    data:

update: It worked when I downgraded to docker desktop 2.3.0.4

Updated Answer :

SinceVSCode Docker 1.14.0 you can now set the Docker executable path in the settings, which should help in most cases.

VSCode 设置,Docker 路径


Old Answer (Option was removed from Docker Desktop):

The Desktop Docker Version 2.4.0.0 is working for me after I did deactivate the feature Enable cloud experience . You can find it under Preferences --> Command Line .

云体验


If you are still experience the problem, you may try a clean remove and install of Docker and also make sure that Docker is actually running , see other possible solution(s) here.


History of GitHub Issues:

您可能会收到以下错误消息,只是因为您还没有启动Docker

exec: "com.docker.cli": executable file not found in $PATH

In my case the problem was I had installed and then crudely removed the docker compose cli. This resulted in the above error to start popping up.

I got the compose CLI back using instructions from https://docs.docker.com/cloud/ecs-integration/#install-the-docker-compose-cli-on-linux and running (as root):

curl -L https://raw.githubusercontent.com/docker/compose-cli/main/scripts/install/install_linux.sh | sh

This fixed it for me.

Note: I would not recommend installing docker-compose cli to fix this issue, but to share some insights in case this is applicable to you as well.

Update: The "cloud experience" no longer exists even as an experimental feature in Docker Desktop v3.2.1. This should no longer be an issue.

If you continue to see this problem on a newer version, you will need to downgrade to Docker v3.1.0, disable the cloud experience feature, then upgrade to the newest version.

Had the exact same issue. Was fixed after starting the upgraded docker first, then running this command.

dostarr@DOSTARR-M-38LF ~ % docker run busybox
exec: "com.docker.cli": executable file not found in $PATH
<started docker>
dostarr@DOSTARR-M-38LF ~ % docker run busybox                           
dostarr@DOSTARR-M-38LF ~ % 

我在尝试运行minikube tunnel时遇到了同样的问题,因为我不想重新安装任何东西,所以我最终从 docker bin 路径运行它(在 Windows 上它位于 'C:\Program Files\Docker\Docker \resources\bin') 并且它起作用了。

Ensure that docker CLI is installed not just docker desktop on Linux. YOu can install it using:

sudo apt install docker.io

An alternative to Docker Desktop is colima , container runtimes on macOS (and Linux) with minimal setup.

# Homebrew
brew install colima, docker

colima start

Now, you can use the docker commands as before.

For docker compose commands, you have to install:

brew install docker-compose

if already have installed docker, it may not have started. So type in terminal,"docker run -d -p 80:80 docker/getting-started" and it should solve the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM