Topics Map > User Guides
Topics Map > Platform R
Platform R: Using the Gitlab Container Registry
Set Your Docker Configuration
On Platform R, run this in your shell: cp /etc/docker/config.json ~/.docker/config.json
Do this before setting up container registry access otherwise you will overwrite it.
Container Registry Access
First you need to create a token in GitLab.
- Log into UW Gitlab: https://git.doit.wisc.edu/
- Go to your account menu (the circle icon at the top left), and select "Preferences."
- Click the three-line "hamburger" icon at the top left and select "Personal access tokens" from the menu.
- Select the "Add new token" button at the right.
- Use the token name ‘registry’.
- The expiration date must be set, and can be set to maximum.
- Select scopes: read_registry, write_registry, read_virtual_registry, api.
- Copy the resulting token.
Run the following command. When it asks for your password or token, use the copied token.
apptainer registry login --username registry docker://registry.doit.wisc.edu
Building a New Container
Definition file example (note this links directly to the docker mirror, but you can build from a docker address directly and it will use the mirror if your config.json is set up): myR.def
Bootstrap: docker
From: git.doit.wisc.edu/smph/smph-it/informatics/infrastructure/platform-r/dependency_proxy/containers/r-base:4.5.1
%post
R -e "install.packages('foreach')"
R -e "install.packages('doFuture')"
%labels
Author Your Name
Version 1.0.0
Description R 4.5.1 with doFuture parallelization.
Start an interactive job on a compute node. At this point, your terminal should begin with <netid>@pr-sett-nnn, which is any node other than pr-sett-001 (the head node). Building images is computationally intensive, so be sure you are on a compute node:
srun -c 1 --mem=24G --time 4:00:00 --pty -u bash -i
Build the image: singularity build myR.sif myR.def
Note: if you are working in a project, add *.sif to your .gitignore file. These files are generally too large for git.
Add a Container to the Container Registry
Be sure you’ve created a GitLab project, either in your own GitLab (with your NetID) or on a group GitLab.
Push the container to the registry:
singularity push myR.sif oras://registry.doit.wisc.edu/smph/[netID]/[myproject]/myR:1.0.0
This will add the container to the GitLab project myproject in an individual’s GitLab. A group GitLab name can be used in place of netID. The container is tagged with a version (in this case 1.0.0) and multiple versions can be hosted in the registry.
To run the container from registry:
srun --cpus-per-task=4 --mem-per-cpu=16G --singularity-container=oras://registry.doit.wisc.edu/smph/[netID]/[myproject]/myR:1.0.0 --pty R
Note the use of oras:// rather than docker:// in the URL.
When you first run a container from the registry it creates a local cache.
Viewing container registry
- In Gitlab, go to the project page.
- Click the three-line "hamburger" icon at the top left,
- then select "Deploy"
- then select "Container registry"

