Home > other >  I cant call my Dockerfiles something else
I cant call my Dockerfiles something else

Time:11-28

My code solution contains a shared project, web frontend and web api project. Due to Dockerfile can't access parent folders the Dockerfiles need to be at the root folder i figure (frontend and api both depend on shared).

So I have Dockerfile.api which is allowed if I have version 1.8 or greater (https://github.com/moby/moby/wiki). I do, I have the latest 4.2

Calling Dockerfile (web api) is successful, but calling docker build -f Dockerfile.api results in this error:

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

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

Build an image from a Dockerfile

What am I missing here? As my repo contains different projects that will result in different images I want different Dockerfiles, and they need to be at the root due to dependencies.

CodePudding user response:

docker build need to have a path argument where the build should be executed.

So the correct command will be:

docker build -f Dockerfile.api .
  • Related