Skip to content

Instantly share code, notes, and snippets.

@fairchild
Last active December 27, 2015 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fairchild/7309068 to your computer and use it in GitHub Desktop.
Save fairchild/7309068 to your computer and use it in GitHub Desktop.
dockerfile defining a basic apt-cacher-ng service
# Apt-Proxy hosting image
#
# VERSION 0.1.0
# Use a modified version of the Ubuntu base image provided by dotCloud
FROM fairchild/ubuntu
MAINTAINER Michael Fairchild fairchild@stimble.net
ENV APT_PROXY apt.dockerdev.att.io
RUN apt-get update && apt-get install -y apt-cacher-ng
RUN echo "Acquire::http { Proxy \"http://127.0.0.1:3142\"; };"| tee -a /etc/apt/apt.conf.d/01proxy
ENTRYPOINT ["/usr/sbin/apt-cacher-ng", "ForeGround=1"]
EXPOSE 3142
@fairchild
Copy link
Author

its not currently launching the apt-cacher-ng process,

root at precise64 in /vagrant/fairchild/apt-proxy on master*
$ docker run -i -t fairchild/ubuntu:apt  /bin/bash
root@dda9af41612e:/# ps
  PID TTY          TIME CMD
    1 ?        00:00:00 bash
    9 ?        00:00:00 ps
root@dda9af41612e:/# cat /etc/apt/apt.conf.d/01proxy 
Acquire::http { Proxy "http://127.0.0.1:3142"; };

@fairchild
Copy link
Author

updated, and it now works

docker build fairchild/ubuntu:apt .
sudo docker run -d -p 3142 -v /vagrant/fairchild/volumes/apt-cache/:/var/cache fairchild/ubuntu:apt 

The -v is just so that the cache can be reused across different containers and container restarts

vagrant at precise64 in /vagrant/fairchild on master*
$ sudo docker run -i -t --link gray_sheep0:apt fairchild/ubuntu /bin/bash
root@4fbbd6275ba0:/# env
APT_PORT_3142_TCP=tcp://172.17.0.115:3142
HOSTNAME=4fbbd6275ba0
TERM=xterm
APT_PORT_3142_TCP_PORT=3142
APT_PORT_3142_TCP_PROTO=tcp
APT_PORT_3142_TCP_ADDR=172.17.0.115
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
SHLVL=1
HOME=/
APT_PORT=tcp://172.17.0.115:3142
DEBIAN_FRONTEND=dialog
APT_NAME=/gold_dog5/apt
container=lxc
_=/usr/bin/env
root@4fbbd6275ba0:/# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment