Publish Container Images
Suppose you have a Docker image and want to publish it to the newly created container registry using:
Note that publishing images with the same image version is not allowed. The server will return the 409 HTTP response.
Publish images using Docker command-line tool
Log in to the container registry:
docker login mycompany.registry.jetbrains.spaceheremycompany.registry.jetbrains.space
is the registry URL(
mycompany
is the name of your company in Space). If you are not sure about the URL, you can copy the URL of a particular container registry on the Packages page.
When asked for credentials, specify either your Space username and password (we recommend that you use a permanent token instead) or a client ID and a client secret of a service account.
If your image is not yet created, build it with
docker build
.Tag the image for the container registry:
docker tag myimage mycompany.registry.jetbrains.space/p/projectkey/mydocker/myimageheremyimage
is the name of your image,mycompany.registry.jetbrains.space/p/projectkey/mydocker/
is the namespace of your container registry. You can find it in Packages, on the page of the particular registry.
Publish the image to the registry:
docker push mycompany.registry.jetbrains.space/p/projectkey/mydocker/myimage
Publish images from JetBrains TeamCity
Prerequisites: You have a working build configuration in TeamCity that creates a Docker image. Your task is to publish this image to a Space Packages registry.
In Space, create an application account that you will use for connecting to Space from TeamCity.
Connect the TeamCity instance to the Packages registry where you want publish images. In TeamCity:
in project properties, choose Connection | Add Connection,
in the connection settings, specify the URL of the Docker registry (it should look like
mycompany.registry.jetbrains.space
) and the application account credentials (a client ID and a permanent token).
Add Docker support to your TeamCity build configuration: In the build configuration settings, choose Build Features | Add build feature.
In the Add Build Feature window:
choose Docker Support,
in Log in to the Docker registry before the build, choose the connection you have created in step 1.
After you add the Docker support, TeamCity will log in to the Space container registry before the build. In addition, the build will get a separate tab with info about created Docker images.
Add corresponding Docker build steps to your build configuration. For example, a step that runs:
docker push mycompany.registry.jetbrains.space/p/projectkey/mydocker/myimage:%build.number%
Publish images from Space Automation
Space Automation provides special DSL to ease building and publishing Docker images. Learn more