Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Tutorials
    • All tutorials
    • Setting up a Managed Service for PostgreSQL connection from a container in Serverless Containers
    • Creating a VM from a Container Optimized Image
    • Creating a VM from a Container Optimized Image with an additional volume for a Docker container
    • Creating an instance group from a Container Optimized Image with multiple Docker containers
    • Creating an instance group from a Container Optimized Image
    • Creating a VM from a Container Optimized Image with multiple Docker containers
    • Updating a Container Optimized Image VM
    • Configuring data output from a Docker container to a serial port
    • Running a Docker image on a VM using Cloud Registry

In this article:

  • Getting started
  • Create a VM with multiple Docker containers
  1. Container infrastructure
  2. Creating a VM from a Container Optimized Image with multiple Docker containers

Creating a VM from a Container Optimized Image with multiple Docker containers

Written by
Yandex Cloud
Updated at August 6, 2026
View in Markdown
  • Getting started
  • Create a VM with multiple Docker containers

In this tutorial, you will create a VM from a Container Optimized Image with multiple Docker containers inside. You will use a Docker Compose specification to create your VM.

Getting startedGetting started

If the Docker image you need is stored in Yandex Container Registry, create a service account with the container-registry.images.puller role for the registry in question. Your Container Optimized Image VM will use this account to pull the Docker image from the registry.

Create a VM with multiple Docker containersCreate a VM with multiple Docker containers

CLI

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

To create a VM from a Container Optimized Image with multiple Docker containers:

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

    yc compute instance create-with-container --help
    
  2. Set up a Docker container specification. Save the following data to the docker-compose.yaml file:

    version: '3.7'
    services:
      app1:
        container_name: nginx
        image: "nginx"
        ports:
          - "80:80"
        restart: always
      app2:
        container_name: redis
        image: "redis"
        restart: always
    
  3. Create a VM with multiple Docker containers:

    yc compute instance create-with-container \
      --name my-vm \
      --zone ru-central1-a \
      --ssh-key ssh-key.pub \
      --create-boot-disk size=30 \
      --network-interface subnet-name=<subnet_name>,nat-ip-version=ipv4 \
      --service-account-name <service_account_name> \
      --docker-compose-file docker-compose.yaml
    

    Where:

    • --name: VM name.

    • --zone: Availability zone.

    • --ssh-key: Path to the public key file and file 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.

    • --network-interface: VM network settings.

    • --service-account-name: Name of the service account you created earlier.

    • --docker-compose-file: YAML file with the container specification.

    Once created, the VM will appear in the VM list under Compute Cloud in the management console.

  4. Check the result.

    1. Connect to the VM over SSH.

    2. View the list of running Docker containers:

      sudo docker ps -a
      

      Result:

      CONTAINER ID  IMAGE  COMMAND                 CREATED         STATUS         PORTS               NAMES
      c79b********  nginx  "nginx -g 'daemon of…"  16 seconds ago  Up 14 seconds  0.0.0.0:80->80/tcp  nginx
      3ac5********  redis  "docker-entrypoint.s…"  2 minutes ago   Up 2 minutes   6379/tcp            redis
      

Was the article helpful?

Previous
Creating an instance group from a Container Optimized Image
Next
Updating a Container Optimized Image VM
© 2026 Direct Cursus Technology L.L.C.