0

I have a simple Dockerfile which looks like the following

FROM debian:stretch-slim as builder
COPY . my_project/
RUN apt-get update && apt-get install -y build-essential libpqxx-dev libtbb-dev

Running this with docker build -t test_proj . I was dismayed to see that apt is trying to install a huge amount (583MB unpacked) of extra libs, including things like python and sqlite (which sound completely unnecessary for pqxx and tbb). I ran apt-rdepends over each and sure enough neither python nor sqlite were in there, so there are surely more 'spurious' libs being installed by apt

Why is this happening and how can I avoid this? I plan to use a multistage to ditch the build tools by the final image anyway, but this is slowing down builds so I'd like to fix it

1
  • 2
    I think this answer on aksubuntu is what you're after: sudo apt-get install --no-install-recommends package-name
    – Tensibai
    Dec 12 '18 at 10:44
1

Have you heard about the distroless? See this link too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.