Getting started with Container Registry
Using these instructions, you will create your first registry and try managing Docker images.
Before you start
To create a registry, you'll need a folder in Yandex.Cloud. If you don't have any folders yet, create a new folder:
-
Click Create folder in the Home page of the management console.
-
Enter the folder name.
- The name must be unique within the folder.
- The name may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter. The last character can't be a hyphen.
- The maximum length of the name is 63 characters.
-
Select Create a default network. A network is created with subnets in each availability zone.
-
Click Create.
You'll also need the Yandex CLI and Docker.
Creating a registry and performing basic operations on Docker images
-
Create a registry in Container Registry:
yc container registry create --name my-first-registry ..done id: crpc9qeoft236r8tfalm folder_id: b1g0itj57rbjk9thrinv name: my-first-registry status: ACTIVE created_at: "2018-12-25T12:24:56.286Z"
You will need the received
id
to access the created registry. -
Authenticate in Container Registry using a Docker Credential helper:
-
Configure Docker to use
docker-credential-yc
:yc container registry configure-docker Credential helper is configured in '/home/<user>/.docker/config.json'
During setup, information about the current user profile is saved.
-
Make sure that Docker is configured.
The
/home/<user>/.docker/config.json
file must contain the following line:"cr.yandex": "yc"
-
-
Pull a Docker image from the Docker Hub repository:
docker pull ubuntu
-
Assign a tag like
cr.yandex/<registry ID>/<Docker image name>:<tag>
to the Docker image pulled:docker tag ubuntu \ cr.yandex/crpc9qeoft236r8tfalm/ubuntu:hello
-
Push the Docker image to the repository Container Registry:
docker push \ cr.yandex/crpc9qeoft236r8tfalm/ubuntu:hello
-
Run the Docker image:
docker run \ cr.yandex/crpc9qeoft236r8tfalm/ubuntu:hello