Docker build command for Dockerfile not in current directory

Viewed 468

I have tried everything, looked up at least 20 similar questions, non could solve it.

I need a docker build command that reads my docker file nested inside the directory.

Docker file is located \Test\Backend\App%20Server\Dev\Test\Application

I have tried the following command none worked

docker build -t test-app -f . Test/Backend/App%20Server/Dev/Test/Application/Dockerfile

docker build -t test-app . Test/Backend/App%20Server/Dev/Test/Application/Dockerfile

docker build -t test-app -f Test/Backend/App%20Server/Dev/Test/Application/Dockerfile

docker build -t test-app -f . Test/Backend/App%20Server/Dev/Test/Application

Note: my Dockfile has the default name

Error returned

"docker build" requires exactly 1 argument.
See 'docker build --help'.

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

Build an image from a Dockerfile

3 Answers
docker build -t test-app Test/Backend/App%20Server/Dev/Test/Application

maybe I'm missing something. Have you tried to move first in your directory, then build the image?

cd \Test\Backend\App%20Server\Dev\Test\Application
docker build -t test-app .

you can use either:

docker build -t test-app -f Test/Backend/App%20Server/Dev/Test/Application/Dockerfile . #dot after the parameters

or


docker build . -t test-app -f Test/Backend/App%20Server/Dev/Test/Application/Dockerfile #dot before the parameters

Related