Questions tagged [docker-multi-stage-build]
221 questions
0
votes
1 answer
Different conditionals on the same Dockerfile
I have a Dockerfile with some commands I would like to use conditionally:
FROM + image_name (I have a M1 chip MacOS so I need to add --platform=linux/amd64 to it but I want to deploy in a AWS EC2 linux instance that doesn't need it)
On production I…

josegp
- 499
- 6
- 21
0
votes
1 answer
How to minimize properly a nestjs / nodejs application with docker slim or other alternatives?
I am trying to improve my docker images by minimizing as much as possible their size. In order to do so I did the follow steps with a nestjs example as a use case:
nest new testing-docker-slim
and then inside of it I created the following docker…

juan garcia
- 1,326
- 2
- 23
- 56
0
votes
0 answers
Second stage doesnt recognize the installation of the first stage in multistage builds docker
I have a container image that is huge 3GB so I have googled how to reduce the size of images and apparently using multistage builds is helpful. But I wasn't able to know how to integrate it in my dockerfile because it seems that the second stage is…

Hkni
- 115
- 1
- 11
0
votes
0 answers
copy --from in docker-compose multi-stage build
I have a Docker file which build a react application, and then runs an nginx server to serve the resulting webpack. I use a multi-stage build, something like:
# Dockerfile
# build application
FROM node:14-alpine AS builder
... project…

bavaza
- 10,319
- 10
- 64
- 103
0
votes
1 answer
is it possible to allow failure in COPY at a Dockerfile?
I have a multistage Docker file like this:
From A as a
WORKDIR /app
COPY . .
From B as b
COPY --from=a /app/path/to/a/file /destination/file/path
Sometimes the source-file of last COPY does not exist and this causes a failure in docker build. Is…

mohammad hosein bahmani
- 106
- 4
0
votes
1 answer
Trying to separate dev stage image from prod stage build using mult-stage building
Well, there's this Node.js app that I built using Typescript + ExpressJS, and now I'm trying to setup docker to have both a working development container and a production one.
I'd like to have only one Dockerfile in order to use the multi-stage…

João Casarin
- 674
- 2
- 9
- 27
0
votes
1 answer
Copying Windows Registry Changes in Multi-stage Builds
I'd like to use multi-stage builds more in Windows images, but a limitation I've hit is that many programs - particularly those for components like Visual Studio and related tools - alter the Windows Registry during their installation process.
Are…

Will Chappell
- 138
- 6
0
votes
1 answer
Python multi stage docker container - local package
I'm running a multi-stage docker build for my python container.
My first build step installs all the dependencies from requirements.txt
##################
## Python Builder Image
##################
FROM python:3.10 AS python-builder
# create and…

Danran
- 471
- 1
- 7
- 21
0
votes
1 answer
Copy poetry virtual env from slim-image to alpine-image and run
I would like to build packages in slim image and then copy built packages to alpine one. For that I created Dockerfile:
FROM python:3.8.7-slim AS builder
ENV POETRY_VIRTUALENVS_CREATE=false
WORKDIR /app
RUN apt-get update
RUN apt-get install -y…

Альберт Александров
- 807
- 1
- 15
- 27
0
votes
1 answer
Docker build performs instructions under another target (multistage)
I have dummy Dockerfile:
FROM python:3.8-alpine3.13 AS python-base
RUN echo http://mirror.yandex.ru/mirrors/alpine/v3.13/main > /etc/apk/repositories; \
echo http://mirror.yandex.ru/mirrors/alpine/v3.13/community >> /etc/apk/repositories
ENV…

Альберт Александров
- 807
- 1
- 15
- 27
0
votes
1 answer
Dockerfile: Copy files from parent image
I'm building a multistage docker image where we have a base image that will be extended to build the actual final image. However I can't seem to copy files that are coming from the parent image into the child.
Base image
FROM debian:10.9-slim AS…

Bram
- 2,515
- 6
- 36
- 58
0
votes
1 answer
Docker compose build args are not passed to dockerfile
I have a docker compose file that builds and runs a couple of dockerfiles locally. I am using multi-stage builds and I pass an argument into my docker build commands. The following works perfectly:
docker build -t local/admin-api --build-arg…

Mike
- 1,718
- 3
- 30
- 58
0
votes
1 answer
Docker Multi Stage Build access Test Reports in Jenkins when Tests Fail
I am doing a multi stage build in docker to separate the app from testing. Now at some point in my Dockerfile I run:
RUN pytest --junit=test-reports/junit.xml
In my Jenkinsfile respectivly I do:
def app = docker.build("app:${BUILD_NUMBER}",…

timbmg
- 3,192
- 7
- 34
- 52
0
votes
1 answer
Having maven inside docker along with wildfly server
I am using apiman tool inside docker. I have developed one custom policy. When I run apiman in standalone mode ( without docker ), apiman is able to take that war ( policy) from .m2 repository. But when I use apiman inside docker it does not…

TheAkashKamble
- 181
- 2
- 17
0
votes
0 answers
How to transform this into a Multi Stage boot with relative paths?
at the moment i am trying to develope a microservice which should be deployed on docker and kubernetes. I also got it working.
The thing is that my docker image with 126mb is quite large so i wanted to use multi stage build in order to reduce size…

Lars Hamus
- 11
- 2