Docker : OCI runtime create failed: executable file not found in $PATH - docker

The error message I am getting while running the container:
Docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
\"mkdir NNEEWW\": executable file not found in $PATH": unknown
My Dockerfile:
FROM python:3
COPY . /
RUN pip install --no-cache-dir -r /requirements.txt
EXPOSE 5678
CMD ["mkdir NNEEWW", "&", "jupyter", "notebook", "--ip=0.0.0.0",
"--port=5678", "--allow-root"]

You need to extract "mkdir NNEEWW", "&"* outside the CMD as in docker CMD is used to run the executable, you can anyway create a new folder before the CMD command if you need by using the command RUN mkdir NNEEWW.

Related

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process

I am trying to build this dockerfile and then run it but I'm getting this error docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "./deployment-service": permission denied: unknown.
This is my docker file, I've created the volumes and networks
FROM golang:1.19.2-alpine as builder
RUN apk add bash
RUN apk add --no-cache openssh-client ansible git
RUN mkdir /workspace
WORKDIR /workspace
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY . ./
RUN go build -o deployment-service cmd/deployment-service/main.go
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /workspace .
ARG DEFAULT_PORT=8080
ENV PORT $DEFAULT_PORT
EXPOSE $PORT
CMD ["./deployment-service"]
this is my run command,
docker run --name=${CONTAINER_NAME} -d --rm -p ${PORT}:80 -e DEPLOYMENT_SERVICE_DATABASE_CONNECTION_URI=mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}#${MONGO_CONTAINER_NAME}:27017/ -e DEPLOYMENT_SERVICE_SERVER_SECRET_KEY=${SECRET_KEY} -e ANSIBLE_CONFIG='./jam-ansible/ansible.cfg' -e DEPLOYMENT_SERVICE_ANSIBLE_SUBMISSION_ROOT=${DEPLOYMENT_ROOT} -v ${DEPLOYMENT_VOLUME}:${DEPLOYMENT_ROOT} --network=${NETWORK_NAME} server:latest
help to get my issue solved.
looks like you need to edit the permissions of the deployment-service file.
try running
chmod a+x ./deployment-service
in the terminal then trying again.
Sometimes you may end up getting this error because you have not specified an entrypoint for your container.
You can do that using ENTRYPOINT inside the Dockerfile
Below is a .NET example:
ENTRYPOINT ["dotnet", "application.dll"]
It seems lack of permission to execute deployment-service. You can add
RUN chmod +x deployment-service
before CMD ["./deployment-service"]
In my case, I got the below error while trying to run the container using the command:
docker container run -p portnumber:portnumber amazoncorretto:17-alpine-jdk
ERROR:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown.
I used amazoncorretto:17-alpine-jdk docker image and in dockerfile instead of bash, I changed it to sh and it worked as bash didn't work with alpine.
Command changed from:
CMD ["bash", "-c", "java -jar test.jar"]
to:
CMD ["sh", "-c", "java -jar test.jar"]

can't turn on docker-compose with FastAPI "exec: "uvicorn": executable file not found in $PATH"

I'm trying to run docker-compose with fastApi app, however I'm getting error
Cannot start service producer: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: "uvicorn": executable file not found in $PATH: unknown
my Dockerfiles looks like that
FROM python:3.9-alpine
WORKDIR /code/producer
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY *.py /code/producer
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "80"]
what am I doing wrong?

(Docker) executable file not found in $PATH: unknown

I am trying to run a dockerfile but keep getting an error and I cant work it out for the life of me...
docker run prometheus-vmware-exporter
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "prometheus-vmware-exporter": executable file not found in $PATH: unknown.
Dockerfile:
FROM golang:1.15 as builder
WORKDIR /src/github.com/devinotelecom/prometheus-vmware-exporter
#WORKDIR /src/usr/bin/prometheus-vmware-exporter
COPY ./ /src/github.com/devinotelecom/prometheus-vmware-exporter
RUN go get -d -v
RUN CGO_ENABLED=0 GOOS=linux go build
FROM alpine:3.8
COPY --from=builder /src/github.com/devinotelecom/prometheus-vmware-exporter/prometheus-vmware-exporter /usr/bin/prometheus-vmware-exporter
#COPY --from=builder /src/github.com/devinotelecom/prometheus-vmware-exporter /home/gsquire/exporter/prometheus-vmware-exporter
EXPOSE 9512
ENTRYPOINT ["prometheus-vmware-exporter"]
Many thanks in advance.

Dockerfile CMD ignored arguments

I'm trying to run an containerized image locally using google cloud shell docker daemon:
> PORT=8080 && docker run -p 9090:${PORT} -e PORT=${PORT} gcr.io/gbl-tpd-endetec-dev1/simplest-helloworld
However i got this error :
> docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"app.py\": executable file not found in $PATH": unknown.
ERRO[0001] error waiting for container: context canceled
When I check container status and in the COMMAND column, i don't have what i expect :
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
977b0ee4b04d gcr.io/gbl-tpd-endetec-dev1/simplest-helloworld "app.py" 11 minutes ago Created 0.0.0.0:9090->8080/tcp youthful_williams
I should have "python ./app.py" since I've written it in my Dockerfile CMD instruction :
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.7-slim
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8080
CMD ["python", "./app.py"]
Can someone help me about what I am missing?

Running Docker lambda image on local

This is the Dockerfile:
FROM lambci/lambda:build-python3.6
# Copy in your requirements file
ADD requirements.txt /requirements.txt
# Copy your application code to the container
RUN mkdir /code/
WORKDIR /code/
ADD . /code/
ENV PS1 'zappa#$(pwd | sed "s#^/var/task/\?##")\$ '
ADD zappa_settings.json /var/task/zappa_settings.json
WORKDIR /var/task
RUN virtualenv /var/venv && \
source /var/venv/bin/activate && \
pip install -U pip zappa && \
pip install -r /requirements.txt && \
deactivate
CMD ["zappa"]
However, when I run docker-compose up I get:
Recreating basesite_web_1 ...
Recreating basesite_web_1 ... error
ERROR: for basesite_web_1 Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"zappa\": executable file not found in $PATH"
ERROR: for web Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"zappa\": executable file not found in $PATH"
ERROR: Encountered errors while bringing up the project.
I assume it's because I need to activate the virtualenv. I want to be able to run the project on my local machine for development. What am I missing? Thanks!

Resources