0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ] らずぱいで、apt-cacher-ngのサーバをDockerにて

Last updated at Posted at 2017-12-11

概要

環境

  • Raspberry Pi 3 model B

  • Docker

     pi@rpi-07e7aa:~/apt-cacher-ng $ docker --version
     Docker version 17.10.0-ce, build f4ffd25
    

手順

  1. Dockerを入れる

  2. Docker 関連..

    Dockerfile
    FROM resin/rpi-raspbian:stretch
    
    ENV APT_CACHER_NG_CACHE_DIR=/var/cache/apt-cacher-ng \
    	APT_CACHER_NG_LOG_DIR=/var/log/apt-cacher-ng \
    	APT_CACHER_NG_USER=apt-cacher-ng
    	
    RUN apt-get update && \
    	DEBIAN_FRONTEND=noninteractive apt-get install -y apt-cacher-ng \
     && sed 's/# ForeGround: 0/ForeGround: 1/' -i /etc/apt-cacher-ng/acng.conf \
     && sed 's/# PassThroughPattern:.*this would allow.*/PassThroughPattern: .* #/' -i /etc/apt-cacher-ng/acng.conf \
     && rm -rf /var/lib/apt/lists/*
     
    COPY entrypoint.sh /sbin/entrypoint.sh
    RUN chmod 755 /sbin/entrypoint.sh
    
    EXPOSE 3142/tcp
    ENTRYPOINT ["/sbin/entrypoint.sh"]
    CMD ["/usr/sbin/apt-cacher-ng"]
    
    ビルド
    wget https://raw.githubusercontent.com/sameersbn/docker-apt-cacher-ng/master/entrypoint.sh
    sudo docker build -t mt08/docker-apt-cache-ng .
    
    実行
    cd ~
    sudo docker run -d -p 3142:3142 -v `pwd`/apt-cacher-ng:/var/cache/apt-cacher-ng mt08/docker-apt-cache-ng
    
    #
    echo 'Acquire::http::Proxy "http://localhost:3142";' | sudo tee /etc/apt/apt.conf.d/02proxy
    sudo apt update
    
    クライアント側設定(ホスト名は、各自変更)
    echo 'Acquire::http::Proxy "http://raspberrypi.local:3142";' | sudo tee /etc/apt/apt.conf.d/02proxy
    
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?