GithubHelp home page GithubHelp logo

aporquez / docker-apt-cacher-ng Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seifer08ms/docker-apt-cacher-ng

0.0 3.0 0.0 106 KB

Dockerfile to create a Docker container image for Apt-Cacher NG

License: MIT License

Makefile 16.67% Shell 61.79% Dockerfile 21.54%
docker apt-cacher-ng

docker-apt-cacher-ng's Introduction

aporquez/apt-cacher-ng:latest


Introduction

This git repository helps you installing and running Apt-Cacher NG quickly on your local machine.

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.

This repository is to create a Docker container image for Apt-Cacher NG.It is a modified version of sameersbn/docker-apt-cacher-ng, lurcio/docker-apt-cacher-ng and seifer08ms/docker-apt-cacher-ng with a few changes including docker compose version, updated the docker FROM image, and updated the setup.sh to cache the packages/indexes from SSL/TLS(HTTPS). Many thanks guys!

Switching offline mode

This feature is the major update from original codes. The Docker container can automatically check network and choose offline or online mode in the beginning of startup. If the network condition is change during running, you can restart it to check it again using docker restart apt-cacher-ng.

Getting started

Installation

Automated builds of the image are available on Dockerhub and is the recommended method of installation.

docker pull akeno379/apt-cacher-ng:latest

Alternatively you can build the image yourself with make command.

make

Quickstart

Start Apt-Cacher NG daemon using:

make install HOST_CACHE_DIR=/srv/docker/apt-cacher-ng

This commnad could mounts a volume for persistence. The parameter HOST_CACHE_DIR denotes the location of mounting a volume at /var/cache/apt-cacher-ng.

Alternatively, you can use the sample docker-compose.yml file to start the container using Docker Compose

Usage

To 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.42.1:3142";
Acquire::HTTPS::Proxy "false";

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.42.1:3142";' >> /etc/apt/apt.conf.d/01proxy \
 && echo 'Acquire::HTTPS::Proxy "false";' >> /etc/apt/apt.conf.d/01proxy

By default apt-cacher-ng doesn't cache the packages/indexes from SSL/TLS(HTTPS). To make apt-cacher-ng cache the packages/indexes via SSL/TLS repositories, we will have to configure apt-cacher-ng to remap a chosen non-https repository url to the actual https url.

Create a file named backends_packages in /etc/apt-cacher-ng that looks like:

https://download.docker.com/linux/ubuntu

Now, in apt-cacher-ng /etc/apt-cacher-ng/acng.conf we can specify a mapping like:

#Remap-RepositoryName: MergingURLs ; TargetURLs ; OptionalFlags

Remap-docker: http://fakedomain.com ; file:backends_packages

We can now configure all our clients to use http://fakedomain.com instead of https://download.docker.com/linux/ubuntu, and apt-cacher-ng will transparently proxy, and more importantly, cache, objects from https://download.docker.com/linux/ubuntu. For more example check the setup.sh.

Note: You may need to add the GPG Key to the machine that uses the proxy.

Upgrading

To upgrade to newer releases:

  1. Download the updated Docker image:
make pull
  1. Stop and remove the container:
make clean
  1. Start the updated image
make install

Shell Access

For debugging and maintenance purposes you may want access the containers shell:

make shell

Further help

See also lurcio/docker-apt-cacher-ng

docker-apt-cacher-ng's People

Contributors

aporquez avatar lurcio avatar seifer08ms avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.