Configuring the environment for deploying a standalone service
-
Create a Docker image in the project and install the required dependencies in the build script. Build the image.
-
Create a secret with a password for your container registry.
If you are using a Yandex Container Registry, get authenticated using the authorized key for the service account that has the required roles and is specified in the project settings:
-
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
-
Get authorized keys for your service account and save them to the
key.jsonfile:yc iam key create --service-account-name default-sa -o key.jsonResult:
id: aje8a87g4eaj******** service_account_id: aje3932acde3******** created_at: "2019-05-31T16:56:47Z" key_algorithm: RSA_2048 -
Run this command:
cat key.json | docker login \ --username json_key \ --password-stdin \ cr.yandexWhere:
cat key.json: Command to write the contents of the key file to the output stream.--password-stdin: Flag that enables reading the password from the input stream.
Result:
Login Succeeded
Note
Authorized keys do not expire, but you can always get new authorized keys and get authenticated again if something goes wrong.
-
-
Upload your Docker image to the container registry. To do this, run this code in a cell:
#!:docker-publish <image_name>:<image_tag> cr.yandex/<image_path>:<tag><image_name>: Name of the image in DataSphere.<image_tag>: Tag of the image in DataSphere.<image_path>: Path to the Container Registry image incr.yandex/<registry_ID>/<image_name>format.<tag>: Image tag.
While uploading, enter the username and select the secret containing the password. For authorization in Container Registry, provide the
json_keytoken type as username and the secret as password. -
In the node creation form, specify the path to the image in this format:
cr.yandex/<registry_address>:<tag>.