Create your first Container Registry
Prerequisites
Section titled “Prerequisites”- You have a STACKIT customer account: Create a customer account
- You have a STACKIT user account: Create a user account
- You have a STACKIT project: Create a project
- You have Docker installed and running
Prepare
Section titled “Prepare”In this Getting started guide you will create an instance and configure it. This guide shows the most common settings for a small developer environment. When following this guide, you will work with the STACKIT Portal.
- Visit the STACKIT portal.
- On the sidebar click on Container Registry.
- In the information box click on Go to Container Registry.
After completing the steps, you see the login page for Container Registry. Login with your STACKIT credentials to create a Container Registry Account and get access to the container registry.
Create a project
Section titled “Create a project”-
Navigate to the Project Creation Page.
After logging in, click on the “Projects” tab, usually located in the left navigation menu. This will take you to a page that lists all existing projects.
-
Click on the “New Project” Button.
This button is usually located in the top left corner of the page or in a prominent location on the page. Click on this button to start the project creation process.
-
Enter project details.
You will be presented with a form that asks for project details. Fill in the required information, which typically includes:
- Project Name: Enter a unique and descriptive name for your project.
- Visibility: In the Beta version of STACKIT Container Registry, all projects will be private. This means that you will have to proactively invite new users to your new projects in order for them to have access to it. You will only be able to do so once said users have already registered in the tool.
-
Finish project creation.
Once you have filled in the required information and configured any additional settings, click on the OK button.
Log in to the container registry
Section titled “Log in to the container registry”To access the container registry, you’ll need to log in using your credentials. There are two ways to do this:
- Open a terminal or command prompt.
- Run the following command:
docker login registry.onstackit.cloud. - Enter your STACKIT email address as the username.
- Enter your password, which can be found in the User Profile section under the CLI secret field.
-
Go to the Robot Accounts overview page by clicking on the Robot Accounts Tab.
-
Click New Robot Account.
-
Enter Robot Account Details.
You will be presented with a form that asks for project details. Fill in the required information, which typically includes:
- Name: Enter a unique and descriptive name for your project.
- Expiration time: Enter the number of days until the account loose access.
-
Select all Permissions
-
You’ll receive the Robot Account’s name and secret after the creation process.
-
Open a terminal or command prompt.
-
Run the following command:
docker login registry.onstackit.cloud -
Enter the Robot Account’s name as the username.
-
Enter the Robot Account’s secret as the password.
For more information, visit Automating Workflows with Robot Accounts.
Push an image
Section titled “Push an image”Tag the Docker image that you want to upload with the project name and a version number. The format of the tag will typically be registry.onstackit.cloud/[project-name]/[image-name]:[version].
As an example we use Nginx:
-
Pull a public Nginx image.
Terminal window docker pull Nginx -
Create an alias of the image.
Terminal window docker tag Nginx registry.onstackit.cloud/[project-name]/Nginx:latest -
Push the image to your registry.
Terminal window docker push registry.onstackit.cloud/[project-name]/Nginx
Once the push command has finished, you can view your newly pushed image in the repository overview of your container registry project. Log in to the container registry web interface and navigate to the project where you uploaded the image. Verify that the image has been uploaded successfully and is visible in the project.
Pull an image and run a container
Section titled “Pull an image and run a container”-
Pull Nginx Image from STACKIT Container Registry.
Terminal window docker pull registry.onstackit.cloud/[project-name]/Nginx:latest -
Start the Nginx container from STACKIT Container Registry.
Terminal window docker run -it --rm -p 8080:80 registry.onstackit.cloud/[project-name]/Nginx -
Open your browser and open
http://localhost:8080to view the running container. -
To stop and remove the container, press Control+C in your terminal.
Remove the image (optional)
Section titled “Remove the image (optional)”If you no longer need the Nginx image, you can delete it locally with the docker rmi command.
docker rmi registry.onstackit.cloud/[project-name]/NginxDelete Projects
Section titled “Delete Projects”- Go to the repository overview of your project.
- Select all repositories in the list.
- Click the deletion button.
- Confirm repository deletion by clicking Delete.
- Go to the Container Registry Projects Overivew.
- Select your project.
- Open the Action dropdown menu.
- Click Delete.
- Confirm Deletion by clicking Delete.
Now you executed some basic commands with STACKIT Container Registry. From here on you may dig deeper with the How-tos.