This container image allows to dockerize AptCacherNg, making your Debian-based containers to use the AptCacherNg proxy for both building and running containers. In the best of cases, it will greatly speed up the package installing process on scenarios with large ammount of packages.
Start AptCacherNg container, using a dedicated network
docker network create mynetwork
docker run -d -p 3142:3142 --network=mynetwork -v $(pwd)/cache:/var/cache/apt-cacher-ng amitie10g/apt-cacher-ng
Before get started, add this at the top of the Dockerfile step context, in order to instruct apt to use your proxy:
ARG APT_PROXY
RUN if [ ! -z "$APT_PROXY" ]; then echo "Acquire::http { Proxy \"http://$APT_PROXY:3142\"; };" >> /etc/apt/apt.conf.d/01proxy; fi
And add this at the bottom of the step, in order to remove the proxy from the final image:
rm /etc/apt/apt.conf.d/01proxy
Then, build your container:
docker build --network=mynetwork -v APT_CACHE=<proxy IP address> -t <your container:tag> .
docker run --network=mynetwork -v APT_CACHE=<proxy IP address> <your container:tag> <commands>
Content type
Image
Digest
sha256:215234129…
Size
28.8 MB
Last updated
over 1 year ago
docker pull amitie10g/apt-cacher-ng