diff --git a/README.md b/README.md index 34358a0..75cd1cc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Build Status](https://drone.modem7.com/api/badges/modem7/docker-apt-cacher-ng/status.svg)](https://drone.modem7.com/modem7/docker-apt-cacher-ng) [![GitHub last commit](https://img.shields.io/github/last-commit/modem7/docker-apt-cacher-ng)](https://github.com/modem7/docker-apt-cacher-ng) -Docker image for apt-cacher-ng based off of debian:bullseye-slim +Docker image for apt-cacher-ng. --- @@ -34,7 +34,7 @@ The `latest` tag has multi-arch support for `amd64`, and `arm64` and will automa ## Example usage -``` +```bash docker run -d \ --name apt-cacher-ng \ -p 3142:3142 \ @@ -44,7 +44,7 @@ docker run -d \ ``` ## Docker Compose example -``` +```yaml ################ #APT-Cacher-NG## ################ @@ -70,24 +70,24 @@ This image runs `apt-cacher-ng`, `cron`, and `rsyslogd` to ensure that apt-cache In order to configure a host to make use of apt-cacher-ng on a box, you should create a file on the host `/etc/apt/apt.conf` with the following lines: -``` +```bash Acquire::http::Proxy "http://:3142"; ``` Or a one liner for Debian/Ubuntu hosts: -``` +```bash echo "Acquire::http::Proxy \"http://:3142\";" | sudo tee /etc/apt/apt.conf.d/00proxy ``` You can also bypass the apt caching server on a per client basis by using the following syntax in your `/etc/apt/apt.conf` file: -``` +```bash Acquire::HTTP::Proxy:: "DIRECT"; ``` For example: -``` +```bash Acquire::HTTP::Proxy::get.docker.com "DIRECT"; Acquire::HTTP::Proxy::download.virtualbox.org "DIRECT"; ``` @@ -96,9 +96,29 @@ Note: The above assumes that you are mapping port 3142 on the docker host and 3 You can also update the /etc/apt-cacher-ng/acng.conf and add one or more `PassThroughPattern` lines to force clients to bypass a repository: -``` +```bash PassThroughPattern: get\.docker\.com PassThroughPattern: download\.virtualbox\.org ``` +## Getting https://download.docker.com to cache +If you want to cache your Docker.com downloads, you'll need to change the repo to http. + +For example, if you're following the [Ubuntu install](https://docs.docker.com/engine/install/ubuntu/) instructions, you'll need to do change the following: +Instead of +```bash +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +``` + +Change to: +```bash +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] http://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +``` + +--- + Based on the work from [mbentley](https://github.com/mbentley/docker-apt-cacher-ng) and [sameersbn](https://github.com/sameersbn/docker-apt-cacher-ng).