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.
Related
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"]
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?
I build a Go docker image from docker file successfully, but docker run -p port:port --name imagename imageid gives me permission denied error.
This is my docker file
FROM golang:1.17.2-alpine3.13 as build
WORKDIR /app
COPY . .
RUN go build -o app
FROM alpine:3.7
COPY --from=build /app /usr/local/bin/go_webhooks
RUN chmod +x /usr/local/bin/go_webhooks
ENTRYPOINT ["/usr/local/bin/go_webhooks"]
I tried using chmod but still could not solve it.
The actual error message is:
docker run -p 8000:8000 --name go_webs3 d5f30e8f9703
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:380: starting container process caused: exec:
"/usr/local/bin/go_webhooks": permission denied: unknown.
ERRO[0000] error waiting for container: context canceled
A past similar error message pointed out to a go build issue.
But in your case, copying a folder to /usr/local/bin/go_webhooks would make go_webhooks a folder.
WORKDIR /app
# means /app is a folder
You cannot directly execute a folder.
Your Entrypoint needs to reference an executable inside that folder.
You might needs to copy the built file inside /app:
COPY --from=build /app/app /usr/local/bin/go_webhooks
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?
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.