Failed to start a docker with docker compose on MAC (docker desktop)
Here is the output from docker inspect:
{
"Start": "2019-06-10T13:30:15.2105502Z",
"End": "2019-06-10T13:30:15.3055115Z",
"ExitCode": -1,
"Output": "OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused \"exec: \\\"curl\\\": executable file not found in $PATH\": unknown"
}
The section in docker compose is:
mydocker:
image: mydocker
container_name: mydockername
hostname: mydockerhostname
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 1m30s
timeout: 10s
retries: 3
networks:
- confluent
ports:
- "8080-8090:8080"
volumes:
- myvolume:/pathname
command:
- start
- --insecure
I used the docker stop/start, or docker kill/run, but no success.
I was able to use the same docker compose script to launch the container several weeks ago, and I don't remember I have done anything on Mac, such as OS upgrade, to cause the problem.
It appears that the Docker image you're using doesn't have curl
installed.
Assuming that it's based on Debian or Ubuntu you need to add RUN apt-get update && apt-get install -y curl
to your Dockerfile
. If it's Alpine then RUN apk update && apk add curl
should do the trick.
After you rebuild the mydocker
image ( docker-compose build mydocker
), docker-compose up
should work (assuming there are no other problems). You can also rebuild and start containers in one go: docker-compose up --build
.
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.