Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Container Solution
  • Comparison with other Yandex Cloud services
  • Getting started
  • Pricing policy
  • Container Optimized Image releases
  • FAQ
  • Troubleshooting

In this article:

  • Getting started
  • Create a Docker container VM from a Container Optimized Image

Creating a VM from a Container Optimized Image

Written by
Yandex Cloud
Updated at May 13, 2025
  • Getting started
  • Create a Docker container VM from a Container Optimized Image

Create a VM from a Container Optimized Image and run a Docker container on it.

Getting started

If the required Docker image has been pushed to Container Registry, create a service account with the container-registry.images.puller role for the registry in use. A Container Optimized Image VM will pull the Docker image from the registry under this account.

Create a Docker container VM from a Container Optimized Image

Management console
CLI
  1. In the management console, select the folder where you want to create your VM.

  2. From the list of services, select Compute Cloud.

  3. In the left-hand panel, select Virtual machines.

  4. Click Create virtual machine.

  5. Under Boot disk image, navigate to the Container Solution tab.

  6. Click Configure.

  7. In the Docker container settings window that opens, set the parameters using the suggestions:

    1. Specify the Docker image for running the Docker container on the VM.

    2. Select the Restart policy field value for the Docker container:

      • Always: Always restart the Docker container when it stops.
      • On-Failure: Only restart the Docker container if it shuts down with a non-zero return code.
      • Never: Do not restart the Docker container automatically.
    3. Fill in the remaining fields, if required.

    4. Click Apply.

  8. Follow this guide to configure the remaining VM parameters.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View the description of the CLI command for creating a VM from a Container Optimized Image:

    yc compute instance create-with-container --help
    
  2. Create a Container Optimized Image VM:

    yc compute instance create-with-container \
      --name my-vm \
      --zone ru-central1-b \
      --ssh-key ssh-key.pub \
      --service-account-name my-robot \
      --platform standard-v3 \
      --create-boot-disk size=30 \
      --public-ip \
      --container-name=my-app \
      --container-image=cr.yandex/mirror/ubuntu:16.04 \
      --container-command=sleep \
      --container-arg="1000" \
      --container-env=KEY1=VAL1,KEY2=VAL2 \
      --container-privileged
    

    Where:

    • --name: VM name.

    • --zone: Availability zone.

    • --ssh-key: Contents of the public key file.

    • --service-account-name: Service account name.

    • --create-boot-disk size: Boot disk size.

      To get the minimum boot disk size required for installing an image, run this command:

      • yc compute image get-latest-from-family container-optimized-image --folder-id standard-images if you are installing a Container Optimized Image.
      • yc compute image get-latest-from-family container-optimized-image-gpu --folder-id standard-images if you are installing a GPU Container Optimized Image.

      You can find the minimum boot disk size in the min_disk_size property.

    • --public-ip: Public IP address allocated to the VM.

    • --container-name: Docker container name.

    • --container-image: Name of the Docker image used to run the Docker container.

    • --container-command: Command to run when you start the Docker container.

    • --container-arg: Parameters for the command specified in --container-command.

    • --container-env: Environment variables available in the Docker container.

    • --container-privileged: Run the Docker container in privileged mode.

    Result:

    done (17s)
     id: epdbf646ge5q********
     folder_id: b1g88tflru0e********
     created_at: "2023-03-13T09:44:03Z"
     name: my-vm
    ...
    

    Once created, the VM will appear in the VM list under Compute Cloud in the management console. For more information about working with VMs, see our step-by-step guides.

What's next

  • Read the detailed description of a Container Optimized Image.
  • To learn what else you can do with a Container Optimized Image, see our step-by-step guides.

Was the article helpful?

Previous
Comparison with other Yandex Cloud services
Next
All tutorials
© 2025 Direct Cursus Technology L.L.C.