How to work with disks
Written by
Updated at April 18, 2025
Working with a boot disk
When creating a Container Optimized Image VM, keep in mind that:
-
You cannot create a boot disk from a disk snapshot.
-
By default, you create a disk the same size as the image. Therefore, a Container Optimized Image VM may not have enough free space to deploy a Docker container. To avoid this, specify the required boot disk size using this flag:
--create-boot-disk size=<disk_size_in_GB>
.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.
Use cases
- Creating a VM from a Container Optimized Image with multiple Docker containers
- Running a containerized app in Yandex Serverless Containers
Working with secondary disks
You can mount a secondary disk into the container by using the x-yc-disks
section of the Docker Compose specification:
- To mount a disk into a Container Optimized Image VM and search in the
/dev/disk/by-id/virtio-...
tree, use the diskdevice-name
. If you do not specify this parameter when connecting the disk to the VM, you may get a mount error. - When using a partitioned secondary disk, provide the
partition: x
parameter in the Docker Compose specification, wherex
is the number of the partition to mount.