Skip to content

Commit 7495a4b

Browse files
authored
Merge pull request #308 from EPCCed/container-reg
ECIR (Container Image Registry) Documentation
2 parents de39978 + 0922ea0 commit 7495a4b

File tree

11 files changed

+398
-0
lines changed

11 files changed

+398
-0
lines changed

docs/images/registry/foundsbom.png

151 KB
Loading

docs/images/registry/nosbom.png

114 KB
Loading

docs/images/registry/push.png

178 KB
Loading
487 KB
Loading
453 KB
Loading
46.8 KB
Loading

docs/services/registry/faq.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# FAQ
2+
3+
## Known Issues
4+
5+
### Unauthorised error when logging into the registry from Docker
6+
7+
If you have been logged in to the ECIR web UI for a long time (> 5 hours) and you attempt to login to the registry from Docker you may get an error of the form:
8+
9+
```bash
10+
Error response from daemon: Get "https://registry.eidf.ac.uk/v2/": unauthorized:
11+
```
12+
13+
This means the OAUTH token given to your account by the SAFE has expired, to rectify this you should logout from the ECIR web UI and then login again via the SAFE.
14+
15+
You can check the status of your SAFE OAUTH token by visiting [safe.epcc.ed.ac.uk/TransitionServlet/Tokens/](https://safe.epcc.ed.ac.uk/TransitionServlet/Tokens/).
16+
17+
### SBOM says no SBOM (A Missing SBOM)
18+
19+
If you see an image you have uploaded to the registry have no attached SBOM after it has been scanned, like this:
20+
21+
![NoSBOMOutputReport](../../images/registry/nosbom.png){: class="border-img"}
22+
*Missing SBOM Output Report*
23+
24+
Then you will have to click the folder icon next to the artifact name.
25+
26+
This will open the information up for that artifact, like this:
27+
28+
![FoundSBOMOutputReport](../../images/registry/foundsbom.png){: class="border-img"}
29+
*Found SBOM Output Report*
30+
31+
Some images when uploaded have additional elements packaged with them, and Harbor attaches the SBOM to the container image rather than the whole package.

docs/services/registry/index.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Overview
2+
3+
EIDF Container Image Registry (ECIR) is an image registry for use in EIDF, EPCC and related services. ECIR uses [Harbor](https://goharbor.io) to provide services for image storage, vulnerability scanning and Software Bill of Materials (SBOM) generation.
4+
5+
## Projects and Public Caches on ECIR
6+
7+
ECIR provides projects with a private space on the service where a project can host multiple container image repositories.
8+
9+
ECIR hosts public cache projects for commonly used images. If you use an image which is commonly pulled from public repositories, using a cache copy can reduce the impact on public services.
10+
11+
Using ECIR for pulling and storing images should help with quick deployment and access control of images for projects. This will help reduce the overhead of EIDF Services pulling repeatedly from external registries.
12+
13+
For information on what projects can use within an ECIR private space and Public Caches, see [ECIR Projects and Caches](./projects.md).
14+
15+
## Working with ECIR
16+
17+
For more information on how to work with ECIR, refer to [Working with ECIR](./working-with.md).
18+
19+
## Features
20+
21+
### Vulnerability scanning by Trivy
22+
23+
All images in the ECIR will be scanned by [Trivy](https://trivy.dev/latest/) by default. A vulnerability report will be available shortly after push to the repositories for all new or updated images.
24+
25+
The report will highlight fixable known issues.
26+
27+
!!! Danger "Not Foolproof"
28+
29+
Just because Trivy indicates few or no vulnerabilities this does not mean the scanned image is free of security issues, Trivy can only scan for known issues and specific types of security problems.
30+
31+
Projects can request that images with vulnerabilities above a set level are not deployable from the ECIR. This can be set on a project level and through a Helpdesk Request on the [EIDF Portal](https://portal.eidf.ac.uk/queries/submit).
32+
33+
![TrivvyOuputReport](../../images/registry/trivvyoutput.png){: class="border-img"}
34+
*Example Trivvy Output Report*
35+
36+
### Software Bill of Materials (SBOM)
37+
38+
SBOMs will be automatically generated on push to the ECIR and associated with an image. This will list what is in an image with its version and license information where possible. These can be downloaded for use in other tooling and distribution.
39+
40+
![SBOMOutputReport](../../images/registry/sbomoutput.png){: class="border-img"}
41+
*Example SBOM Output Report*
42+
43+
## FAQ and Known Issues
44+
45+
The FAQ and known issues can be found in the [ECIR FAQ](faq.md).

docs/services/registry/projects.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Projects
2+
3+
## Projects within EIDF
4+
5+
Every EIDF project can request that a ECIR project is created for them. An ECIR project is a namespace within the registry which contains repositories for container images private to users of that EIDF project.
6+
7+
!!! important "ECIR Projects"
8+
9+
EIDF and other EPCC Projects can have ECIR Projects, all users in the owning project can access the ECIR project. The ECIR project is only for image storage and scanning. The owning project can have access to a wide range of other services.
10+
11+
### Project Quota
12+
13+
The default project quota for image storage will be 50 GiB.
14+
15+
Quota increase requests should be submitted via the [EIDF Portal](https://portal.eidf.ac.uk/queries/submit).
16+
17+
### Naming
18+
19+
The root project name for each project will be their EIDF project number in the form:
20+
21+
```bash
22+
eidfXXX
23+
```
24+
25+
### Vulnerability Level Tolerance
26+
27+
The default position of the ECIR is that all images can be deployed onto services, if a project would prefer to have a restriction on the vulnerabilities they are willing to tolerate in their projects, a request can be made to helpdesk to enforce a maximum level of vulnerability tolerance.
28+
29+
Vulnerabilities are ranked:
30+
31+
* Critical
32+
* High
33+
* Medium
34+
* Low
35+
36+
Vulnerability scanning is provided via Trivy, more information about severity levels can be found on the [trivy documentation](https://trivy.dev/latest/docs/scanner/vulnerability/#severity-selection).
37+
38+
### Permissions
39+
40+
ECIR users have the [Harbor project maintainer role permissions](https://goharbor.io/docs/2.14.0/administration/managing-users/user-permissions-by-role/), this allows ECIR users to:
41+
42+
* Create and delete repositories in their projects
43+
* Push and pull images from their projects
44+
* Initiate vulnerability and SBOM scans
45+
* View the results of scans
46+
* Edit the labels available to their projects
47+
48+
ECIR Project maintainers **do not** have the permissions to:
49+
50+
* Create new projects
51+
* Edit project configuration
52+
* Delete projects.
53+
54+
## The Library and Public Caches
55+
56+
ECIR provides a common library of standard images. ECIR provides cache projects for four major registries which allow images to be stored for 7 days after use in ECIR for convenient access.
57+
58+
### The Library
59+
60+
The Library is a public project containing ECIR copies of commonly used container images on the GPU Service. This will be updated over time to reflect use and updates on the service.
61+
62+
To use an image from the Library, the image name should be preceded by `registry.eidf.ac.uk/library`, for example if an Ubuntu image with the tag `latest` were available in the Library it would be accessed with:
63+
64+
```bash
65+
registry.eidf.ac.uk/library/ubuntu:latest
66+
```
67+
68+
Use of images from the Library will not count towards project image storage on the ECIR.
69+
70+
The Library will be updated as images are deprecated or updated and is read only for project users.
71+
72+
Whilst users can use public registries to download images, ECIR aims to reduce request load on public systems and provide a local cache to speed up image access. This helps provide a consistent experience as though downloading from the source but with faster download times.
73+
74+
Users can submit images to be added to the Library where they think these would be beneficial for many users or for images that are accessed frequently. These can be self built images or public images. These should be submit via the [EIDF helpdesk](https://portal.eidf.ac.uk/queries/submit) giving the image details, such as image source and tag(s), as well as justification for inclusion.
75+
76+
### Public Caches
77+
78+
Several main public registries can be routed through cache project proxies on ECIR. The cache projects mean that users can pull a public image from a public registry and the ECIR will store a copy of that image automatically. Cached images which are pulled in the following 7 day period will be retained, otherwise images not pulled for 7 days will be removed from the cache project.
79+
80+
This is to reduce pressure on public registries from EIDF systems and to reduce the chance of the public services rate limiting.
81+
82+
The services which have cache projects are:
83+
84+
* Dockerhub [https://hub.docker.com](https://hub.docker.com) - Project docker-cache
85+
* GHCR [https://ghcr.io](https://ghcr.io) - Project ghcr-cache
86+
* Nvidia NGC Registry [https://nvcr.io](https://catalog.ngc.nvidia.com/) - Project nvidia-cache
87+
* Quay.io [https://quay.io](http://quay.io) - Project quay-cache
88+
89+
To use a cache project, the ECIR address and the cache project name should be pre-pended to the name of the image, for example to pull the image, `nvidia/pytorch:25.05-py3` from the Nvidia (NVCR.io) registry, you would use:
90+
91+
```bash
92+
registry.eidf.ac.uk/nvidia-cache/nvidia/pytorch:25.05-py3
93+
```
94+
95+
For Docker, top level images can be referred to directly, such as:
96+
97+
```bash
98+
registry.eidf.ac.uk/docker-cache/alpine:latest
99+
```
100+
101+
Or if they are part of an organisation public repository:
102+
103+
```bash
104+
registry.eidf.ac.uk/docker-cache/mcp/slack:latest
105+
```
106+
107+
What to add in front of your image name:
108+
109+
* Dockerhub: registry.eidf.ac.uk/docker-cache/
110+
* GHCR: registry.eidf.ac.uk/ghcr-cache/
111+
* Nvidia NGC Registry: registry.eidf.ac.uk/nvidia-cache/
112+
* Quay.io: registry.eidf.ac.uk/quay-cache/
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Working with ECIR
2+
3+
## The Registry Interface and Accounts
4+
5+
EIDF Users can access the registry through their SAFE account.
6+
7+
The registry can be logged into at [https://registry.eidf.ac.uk](https://registry.eidf.ac.uk). If you are not logged into SAFE, the registry will redirect you to SAFE.
8+
9+
User tokens can be accessed from the User Profile from the dropdown under your Username at the top right hand corner of the page. These will be needed to log into the registry from Docker and other container services.
10+
11+
![UserProfile](../../images/registry/userprofile.png){: class="border-img"}
12+
*Example User Profile*
13+
14+
See the FAQ section ['Unauthorised' error when logging into the registry from Docker](./faq.md#unauthorised-error-when-logging-into-the-registry-from-docker) for help with token expiry and authorisation issues.
15+
16+
## Push Commands
17+
18+
In your project, there is a PUSH Command option which will give you the command templates for pushing to the Project repositories from different clients.
19+
20+
![PushCommand](../../images/registry/push.png){: class="border-img"}
21+
*Example Push Command*
22+
23+
## Repositories
24+
25+
Each repository in a project has a COPY PULL button option once an image/artifact has been selected for Docker and Podman.
26+
27+
Clicking on a tag in a repository will open up the information on the artifact, this can include an overview of the image, vulnerability summary, SBOM and build history.
28+
29+
## Using from the Command Line with Docker
30+
31+
Important: Run these commands on a system that has Docker installed and has access to the ECIR.
32+
33+
To login to the registry from a Docker client, you should use the following:
34+
35+
```bash
36+
docker login registry.eidf.ac.uk
37+
```
38+
39+
If you have previously done this and the credentials are valid, then it will confirm your login.
40+
41+
If you have not logged in, the following prompt will appear:
42+
43+
```bash
44+
Username:
45+
```
46+
47+
You should enter the username (your SAFE preferred username) which appears in the User profile section of the Harbor, ECIR web interface.
48+
49+
```bash
50+
Password:
51+
```
52+
53+
You should copy the CLI Secret from the User Profile into this prompt.
54+
55+
The following should appear, unless you are using a credential helper, which will remove the warning.
56+
57+
```bash
58+
WARNING! Your password will be stored unencrypted in <home directory>/.docker/config.json.
59+
Configure a credential helper to remove this warning. See
60+
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
61+
62+
Login Succeeded
63+
```
64+
65+
From your command line, you can now push and pull images to the registry.
66+
67+
## Kubernetes/GPU Service Access
68+
69+
To pull images from the registry, from private or authenticated projects, you will need to add a secret to the namespace you are using and reference it in your job definition. Note that user tokens have a limited validity period.
70+
71+
If you are regularly using a repository from a project where you are sharing resources, it is recommended to create a robot account with limited read only privileges, this can be requested via a Helpdesk Request for your project.
72+
73+
!!! important "Portal Management"
74+
75+
There will be new functionality soon added to the EIDF Portal to allow for project users to create read only robot accounts and for PI/Managers to create read/write robot accounts for use in CI/CD pipelines for image building.
76+
77+
This is then treated like a normal user secret when you have the robot credentials.
78+
79+
Secrets can be created in one of two ways, as detailed below, either directly via kubectl from your Docker config.json file, or by creating a YAML file.
80+
81+
More details on Kubernetes secrets can be found in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/secret/).
82+
83+
### Secret Creation via Docker config.json
84+
85+
!!! Tip
86+
This section requires that you have logged into ECIR via Docker as described in *[Using from the command line with Docker](#using-from-the-command-line-with-docker)*. It also requires that kubectl is installed.
87+
88+
Running the following command will create a secret `<secret-name>` in your project namespace. This can be used by Kubernetes to pull from your private repositories.
89+
90+
The secret that is created will bundle together authentication information in the passed-in Docker config.json file.
91+
92+
If you have logged in to other registries the bundled secret will include authentications from these registries e.g., DockerHub and the GitHub Container Registry. See the documentation for more details on [Kubernetes secret creation](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_create/kubectl_create_secret_generic/).
93+
94+
```bash
95+
kubectl create secret generic <secret-name> \
96+
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
97+
--type=kubernetes.io/dockerconfigjson -n <your namespace>
98+
```
99+
100+
!!! warning
101+
Usage of `~` to denote your home directory in the above command does not work.
102+
103+
You can view details of the new secret by running:
104+
105+
```bash
106+
kubectl describe secret <secret-name> -n <your namespace>
107+
```
108+
109+
### Secret Creation via YAML
110+
111+
Important: Run these commands on a system that has kubectl installed and has access to the ECIR.
112+
113+
You do not need to be logged in to Docker to perform this setup, we manually encode our details and pass it to YAML.
114+
115+
Encode your authorisation information into base64 for inclusion in the Kubernetes secret. The CLI Secret value is taken from your User profile in the registry web interface.
116+
117+
![UserProfile](../../images/registry/userprofile.png){: class="border-img"}
118+
*User Profile*
119+
120+
```bash
121+
echo '{"auths":{"https://registry.eidf.ac.uk":{"username":"<your username>","password":"<your CLI Secret>"}}}' | base64
122+
```
123+
124+
This will generate a string of characters, it may have line breaks on output, and for the next part, you can remove the line breaks and make it a single line.
125+
126+
```bash
127+
eyJhdXRocyI6eyJodHRwczovL3JlZ2lzdHJ5LmVpZGYuYWMudWsiOnsidXNlcm5hbWUiOiJyb2Jv
128+
dCR0ZXN0X2xpYnJhcnkrZ3B1X2RlZmF1bHQiLCJwYXNzd29yZCI6InZrakRHRzNwSG9lTVc0bEtp
129+
THRTZGt3ZXdlcVlpRDFxc1RPT2cifX19Cg==
130+
```
131+
132+
Create a YAML File with the following information:
133+
134+
```bash
135+
apiVersion: v1
136+
kind: Secret
137+
metadata:
138+
name: <secret-name>
139+
namespace: <your project namespace>
140+
type: kubernetes.io/dockerconfigjson
141+
data:
142+
.dockerconfigjson: >-
143+
<the output from the encoding process>
144+
```
145+
146+
For example:
147+
148+
```bash
149+
apiVersion: v1
150+
kind: Secret
151+
metadata:
152+
name: eidfreg
153+
namespace: eidf000ns
154+
type: kubernetes.io/dockerconfigjson
155+
data:
156+
.dockerconfigjson: >-
157+
eyJhdXRocyI6eyJodHRwczovL3JlZ2lzdHJ5LmVpZGYuYWMudWsiOnsidXNlcm5hbWUiOiJyb2JvdCR0ZXN0X2xpYnJhcnkrZ3B1X2RlZmF1bHQiLCJwYXNzd29yZCI6InZrakRHRzNwSG9lTVc0bEtpTHRTZGt3ZXdlcVlpRDFxc1RPT2cifX19Cg==
158+
```
159+
160+
To create the secret run:
161+
162+
```bash
163+
kubectl apply -f <your filename> -n <your namespace>
164+
```
165+
166+
### Using in a Job
167+
168+
Use the image name from the pull command for the repository. For example, this could be `registry.eidf.ac.uk/nvidia-cache/nvidia/k8s/cuda-sample:nbody`, the ECIR cached version of the [NVIDIA sample](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/k8s/containers/cuda-sample): `nvcr.io/nvidia/k8s/cuda-sample:nbody`.
169+
170+
This is an example using an image and secret to access the registry. Replace the appropriate values with your own configuration.
171+
172+
The below example will function without a secret as the image is in a public repository.
173+
174+
``` yaml
175+
apiVersion: batch/v1
176+
kind: Job
177+
metadata:
178+
generateName: jobtest-
179+
labels:
180+
kueue.x-k8s.io/queue-name: <project-namespace>-user-queue
181+
spec:
182+
completions: 1
183+
template:
184+
metadata:
185+
name: job-test
186+
spec:
187+
containers:
188+
- name: cudasample
189+
image: registry.eidf.ac.uk/nvidia-cache/nvidia/k8s/cuda-sample:nbody
190+
args:
191+
- '-benchmark'
192+
- '-numbodies=512000'
193+
- '-fp64'
194+
- '-fullscreen'
195+
resources:
196+
requests:
197+
cpu: 2
198+
memory: 1Gi
199+
limits:
200+
cpu: 2
201+
memory: 4Gi
202+
nvidia.com/gpu: 1
203+
restartPolicy: Never
204+
imagePullSecrets:
205+
- name: <secret-name>
206+
```

0 commit comments

Comments
 (0)