/apt.proxy

Proxy for caching .rpm and .deb packages from Linux repository mirrors.

Primary LanguageDockerfile

Linux Package Proxy Cache

Proxy server intended for caching .rpm and .deb packages from a Linux repository mirror.

Usage

Run proxy container

$ docker run \
	--name="packages" \
	--rm=true \
	--volume=repository-package-cache:/var/cache/nginx:Z \
	docker.io/aesiniath/proxy:latest

runs in foreground and logs when requests hit its cache. In this repo this command is conveniently contained in ./run.sh so:

$ ./run.sh

Change configuration of new images

Change the repository configurations in your base image to point to the internal package mirror:

Fedora

In /etc/yum.repos.d/ adjust fedora.repo to have:

baseurl=http://127.0.0.1:1999/fedora/linux/releases/$releasever/Everything/$basearch/os/

and in fedora-updates.repo to have:

baseurl=http://127.0.0.1:1999/fedora/linux/updates/$releasever/$basearch/

Debian

Adjust /etc/apt/sources.list to have:

deb http://127.0.0.1:1999/debian/ stretch main
deb http://127.0.0.1:1999/debian/ stretch-updates main

Use normally

Build on a Fedora base image:

$ docker run -i -t --rm --network="proxy" localhost/afcowie/fedora:27 bash
ab317b9920d3 / # dnf install -y findutils
...

or building on a Debian base image:

$ docker run -i -t --rm docker.io/aesiniath/debian:stretch bash
d874ac8dd5d4 / # apt-get install findutils
...

Enjoy!

Bugs

See TODO.

Acknowledgements

This container was set up based on incredibly helpful posts from: