GithubHelp home page GithubHelp logo

dockerfile-apt-mirror's Introduction

apt-mirror Docker Image

Tag Dockerfile Image Layers
bionic Dockerfile
xenial Dockerfile

Usage

docker run -v $PWD/apt-mirror:/var/spool/apt-mirror helphi/apt-mirror:xenial
docker run -v $PWD/apt-mirror:/usr/local/apache2/htdocs -p80:80 httpd:2.4.29-alpine

Change Schedule

mkdir cron.d

echo "0 3 * * * root /usr/bin/apt-mirror > /var/spool/apt-mirror/cron.log" > cron.d/apt-mirror
chown root:root cron.d/apt-mirror
chmod 644 cron.d/apt-mirror

docker run \
  -v $PWD/apt-mirror:/var/spool/apt-mirror \
  -v $PWD/cron.d:/etc/cron.d \
  helphi/apt-mirror:xenial

Change Mirror Source

mkdir apt

cat << EOF > apt/mirror.list
############# config ##################
#
# set base_path    /var/spool/apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############

deb http://cn.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
#deb http://cn.archive.ubuntu.com/ubuntu xenial-proposed main restricted universe multiverse
#deb http://cn.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse

deb-src http://cn.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
#deb-src http://cn.archive.ubuntu.com/ubuntu xenial-proposed main restricted universe multiverse
#deb-src http://cn.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse

clean http://cn.archive.ubuntu.com/ubuntu
EOF

docker run \
  -v $PWD/apt-mirror:/var/spool/apt-mirror \
  -v $PWD/apt:/etc/apt \
  helphi/apt-mirror:xenial

dockerfile-apt-mirror's People

Contributors

helphi avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jinnzy

dockerfile-apt-mirror's Issues

Changing the cron line

Hi there,
Thank you for putting this repository out there. I tried to implement this on my Synology NAS using docker but ran into a few problems.

Debugging the issue became problematic (corn job didn't run but didn't return any errors).
I'd suggest changing this line to append the file (you'll need to touch it first though) and also redirect stderr to stdout.
echo "0 3 * * * root /usr/bin/apt-mirror > /var/spool/apt-mirror/cron.log" > cron.d/apt-mirror

I ended up with a line like:
echo -e "0 3 * * * /usr/bin/apt-mirror >> /var/spool/apt-mirror/cron.log 2>&1\n" > apt-mirror

This brought up my next error - when the task ran - I got the error /bin/sh: 1: root: not found

Which means (at least for my scenario) I need to remove the user. I haven't tried it on any other docker hosts.

Were you able to run this without editing files in the container?

I didn't want to submit a PR in case this worked on your setup.

Also I think I needed to run crontab on the file to get it to register the corn job.

Thanks again!

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.