Questions tagged [docker-multi-stage-build]
221 questions
8
votes
1 answer
Dockerfile build ARG in COPY --from=
I am trying to set up a build process for a project and am running into an issue with using arg in the COPY command.
Part of the process is the build of a library into an image, that is used by multiple other images. The problem occurs in the…

Eskarion
- 83
- 1
- 5
8
votes
1 answer
Multistage dockerfile skip stages
I am trying to build a multistage dockerfile with following stage but all stages are getting executed.
I always c that git clone is getting executed even if I have specified EXECUTION_ENV=local in the docker build
Dockerfile:
ARG…

niklodeon
- 1,320
- 5
- 20
- 51
8
votes
1 answer
Docker Multi-stage Builds and Test results - How to get them?
Apparently, all articles I found about multi-stage builds cover the happy path.
But how to get the test results (e.g. unit or acceptance tests) out of a builder-container when something fails?

Arman
- 875
- 2
- 8
- 30
7
votes
5 answers
Quarkus native executable build: high memory consumption
I'm building a Quarkus native executable with a multi-stage Docker build as described in Quarkus - Building a Native Executable
My project just includes the Hello World-Example with some added ORM-functionality (so not really a lot of dependencies).…

Ben
- 447
- 4
- 13
7
votes
1 answer
Using variables across multi-stage docker build
I want to use variables across multi-stage docker builds. Similar to This question (unanswered at the time of writing.)
My specific use case is to build my Go project in a builder stage and save the directory this is done in in a variable and use…

Amin Karbas
- 562
- 1
- 7
- 16
7
votes
3 answers
ffmpeg install within existing Node.js docker image
I need to use ffmpeg in a Node.js application that runs in a docker container (created using docker-compose). I'm very new to Docker, and would like to know how to command Docker to install ffmpeg when creating the image.
DockerFile
FROM…

Peza
- 1,347
- 1
- 11
- 23
7
votes
1 answer
Docker: How to use multistage images after build finishes
Scenario
Multistage builds combine multiple Dockerfile sections into a single one
Intermediary and final stages can copy files from the upper stages
Final stage is suggested to have only the binaries needed.
With those in mind, I'd like to build…

Marcello DeSales
- 21,361
- 14
- 77
- 80
6
votes
1 answer
How to implement a multistage Docker build with GitHub Actions?
Problem
I have a multistage (two stages) docker build for my container, lets name it cont, that I want so automate via GitHub Actions. The first stage/docker-image of the build-process does seldomly change and takes very long to build; lets call…

joba2ca
- 169
- 2
- 14
6
votes
2 answers
Dummy downsize after Docker build
Using multi-stage builds, I want to downsize an image at the end of Dockerfile, something like this:
FROM ubuntu AS ubuntu_build
RUN # do a lot of build things
FROM alpine
COPY --from=ubuntu_build /app /app
ENTRYPOINT whatever
the alpine image…

Alexander Mills
- 90,741
- 139
- 482
- 817
6
votes
3 answers
Docker multi-stage-build with different project
We are working with two project at the moment:
1 C++ based project
2 Nodejs based project
These two projectes are separated which means they have different codebase(git repoitory) and working directory.
C++ project will produce a node binding file…

hguser
- 35,079
- 54
- 159
- 293
6
votes
1 answer
Why is my final docker image in this multi-stage build so large?
After reading about the enormous image size reductions that are possible with multi-stage docker builds, I'm attempting to slim down the image size for a Dockerfile I have for building a Go binary. My Dockerfile is below.
# Configure environment…

Luke Joshua Park
- 9,527
- 5
- 27
- 44
5
votes
1 answer
Python mysqlclient multi-stage docker build
I'm trying to create a small size python image with mysqlclient for a flask API, this is the dockerfile:
FROM python:3.7-slim as builder
WORKDIR /build
RUN apt update && apt install -y build-essential default-libmysqlclient-dev git
ARG…

Andrei Krestyan
- 101
- 6
5
votes
1 answer
Multi-stage build for R application
I'm trying to create a multi-stage build for an R application based on rocker/r-ubuntu:20.04 image.
The reason that I'm based on that image is to install binary packages via apt-get as suggested in order to improve building time.
If I build the…

falberto
- 83
- 7
5
votes
1 answer
Docker multi-stage build fails if we use CMD in dockerfile
Dockerfile:
FROM maven:3.6.3-openjdk-8 as builder
# Set the working directory.
WORKDIR /usr/src/mymaven
COPY ./ /usr/src/mymaven
CMD [ "mvn" , "clean" , "install" ]
FROM openjdk:8
COPY --from=builder /usr/src/mymaven/target /usr/src/myapp
WORKDIR…

Anwesh Mohapatra
- 194
- 15
5
votes
3 answers
Extract file from multistage Docker build
In a multistage docker build I execute unit tests, generate a coverage report and build an executable in a build stage and then copy the executable over to an run stage:
FROM golang:1.13 AS build-env
COPY . /build
WORKDIR /build
# execute tests
RUN…

Christopher
- 1,103
- 1
- 6
- 18