Search code examples
dockerdocker-build

Why is the docker image not building?


I was following the tutorial on the official website.

https://docs.docker.com/get-started/part2/#build-the-app

I created a directory named dir and added the Dockerfile, app.py and requirements.txt. When I try to build this, the error is-

root@ubuntu:~/dir# docker build -t hello
"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage:  docker build [OPTIONS] PATH | URL | - [flags]

Build an image from a Dockerfile

Solution

  • You forgot to mention location of context-root

    #>docker build -t hello .
    

    Add a . at the end if Dockerfile is at the current location