Host a CRAN mirror using Docker
CRAN mirrors are the backbone to everyday common R usage. They provide the R website and most of the R packages today. Currently there are about 104 official CRAN mirrors. Hosting a CRAN mirror is one step to help the R community and is explained here.
To ease that process, at BNOSAC, we have created a Docker image which sets up a CRAN mirror.
That Docker image can be found and is available for download at the following docker registry: https://registry.hub.docker.com/u/bnosac/cran-mirror
For people who don't know Docker, it is basically a tool which allows developers to containerise an application. In this case, the application is to run a CRAN mirror.
How does it work. 3 steps:
1. Install Docker on your computer or server as explained here, if you haven't done this already.
2. Pull the docker image: docker pull bnosac/cran-mirror
3. Run the CRAN mirror: docker run -p 22:22 -p 80:80 -v /home/bnosac/CRAN/:/var/www/html -d bnosac/cran-mirror
That's it! It started synching CRAN on /home/bnosac/CRAN and will synch every day at 02h30 UTC. You can now go to 0.0.0.0 in your browser or find the ip address where it is running and go to that address in your browser to see the R website (see https://registry.hub.docker.com/u/bnosac/cran-mirror for more info).
Now what can you do with it?
- have a local CRAN mirror in your company
- install.packages("data.table", repos = "mylocalmirror")
- serve the community with another mirror if a closeby mirror is not readily available