San
San

Reputation: 87

how to create docker-build n Docker file after pushed from dockerhub(Error response from daemon: unexpected error reading Dockerfile)

am new to docker I am unable to run the docker code which is pulled from docker hub

1.Windows 10 pro, 64bit

2.able to run hello-world

3.C:\Program Files\Docker\Docker\Dockerfile>docker version Client: Docker Engine - Community Version: 19.03.5 API version: 1.40 Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:22:37 2019 OS/Arch: windows/amd64 Experimental: false

Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:29:19 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683

  1. C:\Program Files\Docker\Docker\Dockerfile>docker push mydockerhub/shoprite:latest pulled successfully

5.PROBLEM C:\Program Files\Docker\newfile>docker build -t mydockerhub/shoprite:latest . Sending build context to Docker daemon 4.096kB Error response from daemon: unexpected error reading Dockerfile: read /var/lib/docker/tmp/docker-builder712136353/Dockerfile: is a directory

6.Error: I also want used commands: https://docs.google.com/document/d/1aRt71Vtx13IbGLlcMzH-CyESvudLrCAnHg6fG9Zx3eU/edit

Q1.how to create Dockerfile and docker build

Upvotes: 1

Views: 5650

Answers (3)

Joao Lima
Joao Lima

Reputation: 21

If you are using docker-compose.yml Just specify Dockerfile name

Wrong dockerfile: ./

Correct dockerfile: ./Dockerfile

Upvotes: 2

Tahmid Hossain
Tahmid Hossain

Reputation: 1

If you have a dockerfile located somewhere in a file, first go to that file through commands i.e. cd ./onedrive/desktop/newfolder/docker/.

Then run command docker build . -t <your imagename : your image tag>

Here . gives you a default path where all the files in the local directory get tard and sent to the Docker daemon. -t gives you chance to give your image a name with a tag separated by :.

You then need to use the docker run command i.e. docker run <option/command> imagename.

It will give you a writeable container layer over the specified image, and then starts it using the specified command.

Use command docker ps to see if you have created a container with the image name you used. If not, there is probably a problem with how you are doing it or your pc environment.

P.S. You need to understand that dockerfile is a docker file, not a directory. So, if you see that your current directory is something/something/docker/dockerfile, you made a mistake. The dockerfile goes into docker folder by default.

Good luck

Upvotes: 0

Mihai
Mihai

Reputation: 10757

You can already see the problem at step 3. You created Dockerfile as a directory. It is a file. Delete the directory and make sure you have a file called Dockerfile in the directory where you run docker build. Make sure that Dockerfile is correctly edited.

Upvotes: 0

Related Questions