I have a Dockerfile that looks like this:
FROM image
WORKDIR /App
ADD ./App/ /App
ENTRYPOINT [ "./App" ]
In the App direction I am mounting a golang binary and its config.yml.
The image builds and runs correctly. When I am not running the container detached I can see the app is running as well.
But when I run it detached:
docker run -d image
I cannot exec into container after:
docker exec -it container bin/bash
With an error message:
OCI runtime exec failed: exec failed: container_linux.go:345: starting
container process caused "exec: \"bin/bash\": stat bin/bash: no such
file or directory": unknown
I can understand it has to do with the entrypoint I set, but i am not sure what alternative i could use.
Any ideas?
You should to specify full path to the binary file(/bin/bash in your case) or just name of the binary file located somewhere in your container's PATH variable(bash)
Related
My dockerfile is like below:
FROM python:3.7-alpine
RUN mkdir /app
COPY hello_there.py hello_cmd.py /app
CMD ["python","/app/hello_there.py"]
But whenever I am trying to run the container using below command:
docker run --name singada4 singada /app/hello_cmd.py
It is giving following error:
standard_init_linux.go:228: exec user process caused: exec format error
Both python file is there. I want to just overwrite CMD command with /app/hello_cmd.py while running the container.
docker run -i -t testing bash
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown.
I created the image in Docker Hub , it is private image.
FROM scratch
# Set the working directory to /app
WORKDIR Desktop
ADD . /Dockerfile
RUN ./Dockerfile
EXPOSE 8085
ENV NAME testing
This is in my Dockerfile
I tired to run it, when i run docker images i am getting the details
I think you need to do login in command prompt.useing below command.
docker login -u username -p password url
Apart from the login which should not cause these, as you build an image on your local system which I assume it should exist on local system which will only pull image if not exist on local, the real reason is you are building an image from scratch and there are no binaries in scratch image, even no bash or sh.
Second mistake:
RUN ./Dockerfile
Your Dockerfile is a file, not binaries, while here you are trying to execute using RUN directive.
While scratch appears in Docker’s repository on the hub, you can’t
pull it, run it, or tag any image with the name scratch. Instead, you
can refer to it in your Dockerfile. For example, to create a minimal
container using scratch:
FROM scratch
COPY hello /
CMD ["/hello"]
While here hello can be an executable file such as a C++ compiled file.
Docker scratch image
But what I would suggest to say "hello" in Docker is to use Busybox or Alpine as a base image which has a shell and both are under 5MB.
FROM busybox
CMD ["echo","hello Docker!"]
now build and run
docker build -t hello-docker .
docker run --rm -it hello-docker
I am following 'kubernetes-for-java-developers' Arun gupta's tutorial for learning docker/kubernetes.
https://github.com/arun-gupta/kubernetes-for-java-developers
I am failing in this particular step
docker image build --file Dockerfile.jre -t arungupta/greeting:jre-slim .
while I am using docker desktop, windows container, getting below messege.
F:\Work\Workspace\IntellejIdea\kubernetes-for-java-developers\app>docker
image build --file Dockerfile.jre -t arungupta/greeting:jre-slim .
Sending build context to Docker daemon 219.5MB
Step 1/7 : FROM debian:9-slim
operating system is not supported
while I am using docker desktop, linux container, getting below messege on running below command
docker container run -d -p 8090:8080 arungupta/greeting:jre-slim
F:\Work\Workspace\IntellejIdea\kubernetes-for-java-developers\app>docker container run -d -p 8090:8080 arungupta/greeting:jre-slim
db92a3cc25635d1d2a7f02cd7c94dd11af6b17ea5b258dcaf740de93a05221f7
docker: Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"./myjre/bin/java\": stat ./myjre/bin/java: no such file
or directory": unknown.
My operating system is windows 10 pro.
Dockerfile.jre
FROM debian:9-slim
COPY target/app.war /root
COPY myjre /root/myjre
EXPOSE 8080 5005
WORKDIR /root
ENV _JAVA_OPTIONS '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
CMD ["./myjre/bin/java", "-jar", "app.war"]
As I am new on this docker/kubernetes technology, not sure where to start debugging, or the issues.
help appreciated!!
So I have this Dockerfile:
FROM nginx:alpine
COPY default.conf /etc/nginx/conf.d/
COPY index.html /usr/share/nginx/html/
I build it using:
docker build .
I get the ID: 0154623d6179
And then I run:
docker run 0154623d6179 -d -p 80:80
and I get the error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"-d\": executable file not found in $PATH": unknown.
What am I doing wrong?
Order in the params matters:
docker -d -p 80:80 run 0154623d6179
Whatever comes after image will be considered part of the command to start the container process.
Solved it by putting the image ID at the end of the command
I am trying to use docker file for a flask app. I have this docker file(end of file):
CMD ["/usr/bin/python3 manage.py"]
it's been build successfully with the command sudo docker build -t server . then I run it with sudo docker run -dit -p 5000:5000 -t server:latest but I get :
6acfe48c74d96c12eeda2c2cc98e27d2e5478edaa44f2061336102f04cdf54c4
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/usr/bin/python3 manage.py\": stat /usr/bin/python3 manage.py: no such file or directory": unknown.
Let me know if you need more information. ( I used which python3 and pasted the PATH and used ls and saw manage.py exists there)
When you say:
CMD ["/usr/bin/python3 manage.py"]
You are directing the system to run exactly that file; but there is no file named python3 manage.py in the /usr/bin directory. If you have a separate command and arguments then they need to be two separate things in the CMD listing:
CMD ["/usr/bin/python3", "manage.py"]