docker - Build multiple images from multiple dockerfile -
is there way build multiple images managing 2 different dockerfiles? in case want keep 2 dockerfile suppose dockerfile_app1 dockerfile_app2 within build context.
docker build -t <image_name> . the above pick dockerfile named dockerfile
docker build -t <image_name> dockerfile_app1 this not working case it's expecting file name dockerfile.
i have tried docker-compose build also. din't work.
app1: build: dockerfile_app1 ports: - "80:80" app2: build: dockerfile_app2 ports: - "80:80"
just use -f argument docker build specify name of dockerfile use:
$ docker build -t <image_name> -f dockerfile_app1 . ... or in compose can use dockerfile key version 1.3 onwards:
app1: build: . dockerfile: dockerfile_app1 ports: - "80:80" app2: build: . dockerfile: dockerfile_app2 ports: - "80:80" note build key build context, not name of dockerfile (so looked directory called dockerfile_app1 in case).
Comments
Post a Comment