https://github.com/AEADataEditor/docker-r-starter
This repo provides instructions on how to build an R docker image that can serve as the basis for interactive or automated reproducible processing
https://github.com/AEADataEditor/docker-r-starter
Last synced: 4 months ago
JSON representation
This repo provides instructions on how to build an R docker image that can serve as the basis for interactive or automated reproducible processing
- Host: GitHub
- URL: https://github.com/AEADataEditor/docker-r-starter
- Owner: AEADataEditor
- License: bsd-3-clause
- Created: 2020-10-09T18:29:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-27T14:47:18.000Z (over 1 year ago)
- Last Synced: 2024-08-13T07:15:59.581Z (8 months ago)
- Language: Shell
- Size: 15.6 KB
- Stars: 19
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - AEADataEditor/docker-r-starter - This repo provides instructions on how to build an R docker image that can serve as the basis for interactive or automated reproducible processing (Shell)
README
# Docker image basic R image
## Purpose
Many R replication packages have dependencies, which sometimes include the specific version of R (in particular before/after release of v4).
This Docker image is meant to isolate and stabilize that environment, and should be portable across
multiple operating system, as long as [Docker](https://docker.com) is available.## Build
### Adjust the needed packages
See the [setup.R](setup.R) file, and update accordingly.
> WARNING: not all packages might build, depending on whether the R base image has the relevant libraries. You might want to change R base image, or switch to another image from [rocker](https://hub.docker.com/u/rocker).
### Setup info
Set the `TAG` and `IMAGEID` accordingly.
```
TAG=v$(date +%F)
MYIMG=aer-9999-8888
MYHUBID=aeadataeditor
```
### Build the image```
docker build . -t $MYIMG:$TAG
```
or if using the newer build system
```
DOCKER_BUILDKIT=1 docker build . -t $MYIMG:$TAG
```## Publish the image
The resulting docker image can be uploaded to [Docker Hub](https://hub.docker.com/), if desired.
```
docker push $MYHUBID/${MYIMG}:$TAG
```## Using the image
If using a pre-built image on [Docker Hub](https://hub.docker.com/repository/docker/larsvilhuber/):
```
docker run -it --rm $MYHUBID/${MYIMG}:$TAG
```If using the image you just created:
```
docker run -it --rm $MYHUBID/${MYIMG}:$TAG
```Somewhat more sophisticated, if you are in a project directory (for instance, the replication package you just downloaded), you can access it directly within the image as follows:
```
docker run -it --rm -v $(pwd)/subdir:/code -w /code $MYHUBID/${MYIMG}:$TAG
```You can now start to run code.
## NOTE
This entire process could be automated, using [Travis-CI](https://docs.travis-ci.com/user/docker/#pushing-a-docker-image-to-a-registry) or [Github Actions](https://github.com/marketplace/actions/build-and-push-docker-images). Not done yet.