Updated documentation related to apt-cacher-ng

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2016-01-04 02:00:10 -05:00
parent db738dd77f
commit ac627fbb38
1 changed files with 15 additions and 2 deletions

View File

@ -30,6 +30,8 @@ Use the following Dockerfile:
# and then you can run containers with: # and then you can run containers with:
# docker run -t -i --rm -e http_proxy http://dockerhost:3142/ debian bash # docker run -t -i --rm -e http_proxy http://dockerhost:3142/ debian bash
# #
# Here, `dockerhost` is the IP address or FQDN of a host running the Docker daemon
# which acts as an APT proxy server.
FROM ubuntu FROM ubuntu
MAINTAINER SvenDowideit@docker.com MAINTAINER SvenDowideit@docker.com
@ -52,8 +54,7 @@ use:
$ docker logs -f test_apt_cacher_ng $ docker logs -f test_apt_cacher_ng
To get your Debian-based containers to use the proxy, you can do one of To get your Debian-based containers to use the proxy, you have following options
three things
1. Add an apt Proxy setting 1. Add an apt Proxy setting
`echo 'Acquire::http { Proxy "http://dockerhost:3142"; };' >> /etc/apt/conf.d/01proxy` `echo 'Acquire::http { Proxy "http://dockerhost:3142"; };' >> /etc/apt/conf.d/01proxy`
@ -61,6 +62,8 @@ three things
`http_proxy=http://dockerhost:3142/` `http_proxy=http://dockerhost:3142/`
3. Change your `sources.list` entries to start with 3. Change your `sources.list` entries to start with
`http://dockerhost:3142/` `http://dockerhost:3142/`
4. Link Debian-based containers to the APT proxy container using `--link`
5. Create a custom network of an APT proxy container with Debian-based containers.
**Option 1** injects the settings safely into your apt configuration in **Option 1** injects the settings safely into your apt configuration in
a local version of a common base: a local version of a common base:
@ -80,6 +83,16 @@ which obey `http_proxy`, such as `curl`, `wget` and others:
might need to do it and you can do it from your `Dockerfile` might need to do it and you can do it from your `Dockerfile`
too. too.
**Option 4** links Debian-containers to the proxy server using following command:
$ docker run -i -t --link test_apt_cacher_ng:apt_proxy -e http_proxy=http://apt_proxy:3142/ debian bash
**Option 5** creates a custom network of APT proxy server and Debian-based containers:
$ docker network create mynetwork
$ docker run -d -p 3142:3142 --net=mynetwork --name test_apt_cacher_ng eg_apt_cacher_ng
$ docker run --rm -it --net=mynetwork -e http_proxy=http://test_apt_cacher_ng:3142/ debian bash
Apt-cacher-ng has some tools that allow you to manage the repository, Apt-cacher-ng has some tools that allow you to manage the repository,
and they can be used by leveraging the `VOLUME` and they can be used by leveraging the `VOLUME`
instruction, and the image we built to run the service: instruction, and the image we built to run the service: