This repository maintains and enhances sameersbn's docker-apt-cacher-ng project, which is no longer actively maintained.
- Fully Automated Updates: Complete automation pipeline from dependency updates to releases
- Dependabot creates PRs for Ubuntu base image and GitHub Actions updates
- Automated testing, approval, and merging of Dependabot PRs
- Automatic version tagging and release publishing when tests pass
- Zero-touch maintenance for security updates
- Enhanced Features: Integrated improvements from the community including:
- PR #64 - Log aggregation (courtesy of @jack60612)
- PR #65 - Additional enhancements
- Modern CI/CD: Updated GitHub Actions with multi-architecture builds (amd64, arm64, armv7)
- Comprehensive integration tests (6 test scenarios)
- Security scanning with Trivy (HIGH/CRITICAL CVEs)
- Automated build caching for faster iterations
- Active Maintenance: Regular security updates and base image updates
- Daily checks for Ubuntu base image updates
- Monthly GitHub Actions dependency updates
- Automated security patching through the CI/CD pipeline
Images are published to GitHub Container Registry (GHCR) with automated builds on every release.
This repository features a fully automated CI/CD pipeline that handles dependency updates, testing, and releases:
- Dependabot Detection: Dependabot automatically checks for updates daily (Ubuntu base image) and monthly (GitHub Actions)
- Automatic PR Creation: When updates are available, Dependabot creates a pull request
- Automated Testing: The PR triggers comprehensive testing:
- Docker image build (multi-platform)
- Security scanning with Trivy
- 6 integration tests validating functionality
- Auto-Approval & Merge: If all tests pass, the PR is automatically approved and merged
- Version Tagging: For Ubuntu updates, a version tag is automatically created (format:
v3.7.4-YYYYMMDD) - Release Publishing: The version tag triggers multi-architecture image builds and publication to GHCR
- Zero-Touch Maintenance: Security updates are applied automatically without manual intervention
- Always Up-to-Date: Base images stay current with the latest security patches
- Quality Assurance: All updates go through the same rigorous testing before deployment
- Audit Trail: Complete history of all changes via Git commits and GitHub Actions logs
See CLAUDE.md for detailed technical documentation of the automation workflows.
Dockerfile to create a Docker container image for Apt-Cacher NG.
Apt-Cacher NG is a caching proxy, specialized for package files from Linux distributors, primarily for Debian (and Debian based) distributions but not limited to those.
If you find this image useful here's how you can help:
- Send a pull request with your awesome features and bug fixes
- Help users resolve their issues.
- Support the development of this image with a donation
Before reporting your issue please try updating Docker to the latest version and check if it resolves the issue. Refer to the Docker installation guide for instructions.
SELinux users should try disabling SELinux using the command setenforce 0 to see if it resolves the issue.
If the above recommendations do not help then report your issue along with the following information:
- Output of the
docker versionanddocker infocommands - The
docker runcommand ordocker-compose.ymlused to start the image. Mask out the sensitive bits. - Please state if you are using Boot2Docker, VirtualBox, etc.
Automated builds of the image are available on Dockerhub and is the recommended method of installation.
Note: Builds are also available on Quay.io
docker pull mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013Alternatively you can build the image yourself.
docker build -t mountaintopsolutions/apt-cacher-ng github.com/mountaintopsolutions/docker-apt-cacher-ngStart Apt-Cacher NG using:
docker run --name apt-cacher-ng --init -d --restart=always \
--publish 3142:3142 \
--volume /srv/docker/apt-cacher-ng:/var/cache/apt-cacher-ng \
mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013Alternatively, you can use the sample docker-compose.yml file to start the container using Docker Compose
You can customize the launch command of Apt-Cacher NG server by specifying arguments to apt-cacher-ng on the docker run command. For example the following command prints the help menu of apt-cacher-ng command:
docker run --name apt-cacher-ng --init -it --rm \
--publish 3142:3142 \
--volume /srv/docker/apt-cacher-ng:/var/cache/apt-cacher-ng \
mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013 -hFor the cache to preserve its state across container shutdown and startup you should mount a volume at /var/cache/apt-cacher-ng.
The Quickstart command already mounts a volume for persistence.
SELinux users should update the security context of the host mountpoint so that it plays nicely with Docker:
mkdir -p /srv/docker/apt-cacher-ng
chcon -Rt svirt_sandbox_file_t /srv/docker/apt-cacher-ngTo run Apt-Cacher NG with Docker Compose, create the following docker-compose.yml file
---
version: '3'
services:
apt-cacher-ng:
image: mountaintopsolutions/apt-cacher-ng
container_name: apt-cacher-ng
ports:
- "3142:3142"
volumes:
- apt-cacher-ng:/var/cache/apt-cacher-ng
restart: always
volumes:
apt-cacher-ng:The Apt-Cache NG service can then be started in the background with:
docker-compose up -dTo start using Apt-Cacher NG on your Debian (and Debian based) host, create the configuration file /etc/apt/apt.conf.d/01proxy with the following content:
Acquire::HTTP::Proxy "http://172.17.0.1:3142";
Acquire::HTTPS::Proxy "false";
If you are using a Laptop that is not always able to reach apt-proxy-ng in order to be able detect where to use the proxy or connect direct, use the these 2 files on the Laptop
cp examples/01proxy /etc/apt/apt.conf.d/
cp examples/apt-proxy-detect.sh /usr/local/bin/
Similarly, to use Apt-Cacher NG in you Docker containers add the following line to your Dockerfile before any apt-get commands.
RUN echo 'Acquire::HTTP::Proxy "http://172.17.0.1:3142";' >> /etc/apt/apt.conf.d/01proxy \
&& echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxyif you want to create your own image that has apt-cacher-ng preinstalled look at the sample config in the docker directory
To access the Apt-Cacher NG logs, located at /var/log/apt-cacher-ng, you can use docker exec. For example, if you want to tail the logs:
docker exec -it apt-cacher-ng tail -f /var/log/apt-cacher-ng/apt-cacher.logUsing the Command-line arguments feature, you can specify the -e argument to initiate Apt-Cacher NG's cache expiry maintenance task.
docker run --name apt-cacher-ng --init -it --rm \
--publish 3142:3142 \
--volume /srv/docker/apt-cacher-ng:/var/cache/apt-cacher-ng \
mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013 -eThe same can also be achieved on a running instance by visiting the url http://localhost:3142/acng-report.html in the web browser and selecting the Start Scan and/or Expiration option.
To upgrade to newer releases:
- Download the updated Docker image:
docker pull mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013- Stop the currently running image:
docker stop apt-cacher-ng- Remove the stopped container
docker rm -v apt-cacher-ng- Start the updated image
docker run --name apt-cacher-ng --init -d \
[OPTIONS] \
mountaintopsolutions/apt-cacher-ng:v3.7.4-20251013For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker exec:
docker exec -it apt-cacher-ng bash