0

Like, i am using dockerfile to build image from one baseimage i have. Contents of Dockerfile are like: step 1) FROM baseimage step 2) RUN tdnf install curl

after running dockerfile, many layers have been created, so main concern is that i have to ignore/remove previous older layers from baseimage(step1) which are having some unwanted libs files, and they are getting included in my final layer. Can someone suggest what could be appropriate approach?

  • You normally don't need to do anything; the later layers only describe differences from the earlier ones, and you need all of the layers to create the complete image. Often if you have build-only dependencies using a [multi-stage build](https://docs.docker.com/build/building/multi-stage/) will let you install those dependencies and build your application, then "start over" with a new `FROM` line; would this approach help your specific use case? – David Maze May 30 '23 at 09:50

0 Answers0