Skip to content

Reduce slim OpenTAP docker image size by 20% by removing apt leftovers

Current docker file content:

RUN apt update
# TAP dotnet core 2.1 dependency
RUN apt install libc6-dev libunwind8 curl git -y

.NET Core already added lib6, so we can leave out libc6-dev: https://hub.docker.com/layers/opentapio/opentap/9.11-slim-ubuntu18.04/images/sha256-141930351284078ae5eca1256ffce41138cd6cadbd9583ff7892a8b5a0b31e1c?context=explore

Furthermore, we can see that the previous steps from .NET docker image does this trick:

/bin/sh -c apt-get update     
&& apt-get install -y --no-install-recommends ca-certificates libc6 libgcc1 libgssapi-krb5-2 libicu60 liblttng-ust0 libssl1.0.0         libstdc++6 zlib1g    
&& rm -rf /var/lib/apt/lists/*

We should also use --no-install-recommends and afterwards remove debris left by apt-get update.