Website | Sla de container op in onze register - Save container to our registry
Press here to see the English version
Uitleg
Een register(Nederlands voor registry) wordt gebruikt om containers(ookwel images genoemd) op te slaan. Een container is een gestandardiseerde ingekapselde omgeving waar een applicatie in draait. Elke container draait hooguit één applicatie. Containers kunnen met elkaar communiseren door poorten te openen. Hieronder vind u instructies om in te loggen op onze register, project aan te maken, een contaier te uploaden naar het project en een robot account aan te maken om de container te kunnen downloaden. Als u een container/image heeft laten bouwen en de container/image upload heet dat ook wel pushen naar het register toe. Het downloaden van een container/image heet ook wel pullen van het register.
Inloggen
Om in te loggen moeten de volgende stappen ondernomen worden:
- Open een webbrowser
- Ga naar https://registry.webhosting.rug.nl
- Login met personeels-account(p-account)
Aanmake project
Om één of meerdere containers te kunnen uploaden(ookwel pushen genoemd) hebt u een project nodig om de containers in op te slaan. Om een project te kunnen aanmaken moet u zijn ingelogd. Hieronder staat uitgelegd hoe u een project kan aanmaken:
- Druk op
+ NEW PROJECT
- Vul het volgende in:
- Project Name: Naam van project(zonder spaties, spaties vervangen met
-
teken) - Access Level: Zet GEEN vink bij
Public
. Wij maken gebruik van robot accounts om de container op te halen - Project quota limits: 10 GiB staat standaard ingesteld en hoeft niet veranderd te worden
- Proxy cache: hoeft niet aangevinkt te worden
- Druk op
OK
. Het project wordt aangemaakt. U ziet een groene balk bovenaan de pagina verschijnen dat het project is aangemaakt. - Aan de rechterkant kunt u een vergrootglas vinden, klik daarop en op het verschenen invoerveld voert u de naam van het aangemaakte project in. Klik op de gewenste projectnaam om het project te openen.
Gebruikers toevoegen/verwijderen
Zorg ervoor dat u bent ingelogd op het register en dat u een project open heeft staan. Doe daarna het volgende:
- Klik op
Members
- Druk op
+ USER
- Bij het geópende venster, voert u het volgende in:
a. BijName
: het p-account of s-account
b. BijRole
: de rol die de gebruiker heeft. Om een container/image te kunnen pushen heeft deze persoon minstensdeveloper
rechten nodig. - Druk op
OK
- De gebruiker kan nu inloggen en een container/image maken
Container/Image pushen
Zodra u een container/image gebouwd heeft moet deze geúpload worden naar het register toe. Dit wordt ook wel pushen naar het register toe genoemd.
Op uw lokale computer waar u de container/image heeft gebouwd, doe het volgende:
- Open een Command Line Interface(CLI), bijvoorbeeld bash of uitvoeren
- Login op het register via docker. Doe dit met het volgende commando:
docker login registry.webhosting.rug.nl -u <gebruikersnaam> -p <wachtwoord>
- Geef een tag aan uw container/image. Dat gaat via het volgende commando:
docker tag <lokale_image_naam>:<lokale_tag> registry.webhosting.rug.nl/<project_naam>/<image_naam>:<tag>
Tip: gebruik als tag de versie nummer en latest. Door latest te gebruiken kunt u automatisch de container/image updaten.
- Push de container/image naar het register met het volgende commando:
docker push registry.webhosting.rug.nl/<project_naam>/<image_naam>:<tag>
- Open een webbrowser, login en controlleer of de container/image in het register staan
Robot account aanmaken
Voor het verkrijgen van de opgeslagen container/image is een robot account nodig. Zo maakt u deze aan:
Voor een Project Robot Account (projectbeheerdersrechten vereist):
- Ga met de webbrowser naar https://registry.webhosting.rug.nl en login op Harbor.
- Ga naar "Projects": Klik in het linker navigatiemenu op "Projects".
- Selecteer het Project: Klik op de naam van het project waarvoor je een robot account wilt aanmaken.
- Selecteer "Robot Accounts": Klik in het projectmenu op de tab "Robot Accounts".
- Nieuw Robot Account: Klik op de knop "+ NEW ROBOT ACCOUNT".
- Vul de informatie in:
a. Name: Geef een naam op voor het robot account. Het account krijgt automatisch het prefix robot$ gevolgd door de projectnaam en de door jou gekozen naam (bijvoorbeeld robot$mijn-project+mijn-robot).
b. Description: (Optioneel) Voeg een beschrijving toe voor het robot account.
c. Expiration Time: Stel een vervaldatum in voor het token van het robot account of selecteer "Never Expire".
d. Permissions: Selecteer de rechten die dit robot account binnen dit specifieke project moet hebben (bijvoorbeeld pull images, push images, push and pull Helm charts). - Klik op "Save": Klik op de knop "Save" om het robot account aan te maken.
- Bewaar het Token: Net als bij een systeem robot account, wordt het geheime token na het aanmaken slechts één keer getoond. Kopieer en bewaar het veilig.
Explanation
A registry is used to store containers (also called images). A container is a standardized, encapsulated environment where an application runs. Each container runs at most one application. Containers can communicate with each other by opening ports. Below you'll find instructions on how to log in to our registry, create a project, upload a container to the project, and create a robot account to download the container. Uploading a built container/image is also known as pushing to the registry. Downloading a container/image is also known as pulling from the registry.
Logging In
To log in, follow these steps:
- Open a web browser.
- Go to https://registry.webhosting.rug.nl
- Log in with your staff account (p-account).
Creating a Project
To upload (also known as pushing) one or more containers, you need a project to store them in. You must be logged in to create a project. Here's how to create a project:
- Click on
+ NEW PROJECT
- Fill in the following:
- Project Name: Name of the project (no spaces, replace spaces with the
-
character). - Access Level: DO NOT check
Public
. We use robot accounts to retrieve containers. - Project quota limits: 10 GiB is set by default and does not need to be changed.
- Proxy cache: Does not need to be checked.
- Click on
OK
. The project will be created. You'll see a green bar appear at the top of the page indicating that the project has been created. - On the right side, you'll find a magnifying glass; click on it. In the input field that appears, enter the name of the created project. Click on the desired project name to open the project.
Adding/Removing Users
Ensure you are logged in to the registry and have a project open. Then, do the following:
- Click on
Members
- Click on
+ USER
- In the opened window, enter the following:
a. UnderName
: The p-account or s-account.
b. UnderRole
: The user's role. To push a container/image, this person needs at leastdeveloper
rights. - Click on
OK
The user can now log in and create a container/image.
Pushing a Container/Image
Once you've built a container/image, it needs to be uploaded to the registry. This is also known as pushing to the registry.
On your local computer where you built the container/image, do the following:
- Open a Command Line Interface (CLI), for example, bash or run.
- Log in to the registry via Docker. Do this with the following command:
docker login registry.webhosting.rug.nl -u <username> -p <password>
- Tag your container/image. This is done with the following command:
docker tag <local_image_name>:<local_tag> registry.webhosting.rug.nl/<project_name>/<image_name>:<tag>
Tip: Use the version number and "latest" as tags. By using "latest", you can automatically update the container/image.
- Push the container/image to the registry with the following command:
docker push registry.webhosting.rug.nl/<project_name>/<image_name>:<tag>
- Open a web browser, log in, and verify that the container/image is in the registry.
Creating a Robot Account
A robot account is required to obtain the stored container/image. Here's how to create one:
For a Project Robot Account (project administrator rights required):
- Go to https://registry.webhosting.rug.nl in your web browser and log in to Harbor.
- Go to "Projects": In the left navigation menu, click on "Projects".
- Select the Project: Click on the name of the project for which you want to create a robot account.
- Select "Robot Accounts": In the project menu, click on the "Robot Accounts" tab.
- New Robot Account: Click on the "+ NEW ROBOT ACCOUNT" button.
- Fill in the information:
a. Name: Provide a name for the robot account. The account will automatically receive the prefix robot$ followed by the project name and your chosen name (e.g., robot$my-project+my-robot).
b. Description: (Optional) Add a description for the robot account.
c. Expiration Time: Set an expiration date for the robot account's token or select "Never Expire".
d. Permissions: Select the permissions this robot account should have within this specific project (e.g., pull images, push images, push and pull Helm charts). - Click on "Save": Click the "Save" button to create the robot account.
- Save the Token: Just like with a system robot account, the secret token is shown only once after creation. Copy and save it securely.