sneha mohan
sneha mohan

Reputation: 19

How to run a private Docker image

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

Upvotes: 0

Views: 225

Answers (2)

Adiii
Adiii

Reputation: 59896

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

Upvotes: 2

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

I think you need to do login in command prompt.useing below command.

docker login -u username -p password  url

Upvotes: 2

Related Questions