Skip to main content
Create a named volume on a specific machine in the cluster. Volumes provide persistent storage for service containers.

Usage

uc volume create VOLUME_NAME [flags]

Arguments

VOLUME_NAME
string
required
Name of the volume to create. Must follow Docker naming conventions (only a-z, A-Z, 0-9, -, _, .).

Flags

-d, --driver
string
default:"local"
Volume driver to use. Default is local.
-o, --opt
string[]
Driver specific options in the form of key=value pairs. Can be specified multiple times.
-l, --label
string[]
Labels to assign to the volume in the form of key=value pairs. Can be specified multiple times.
-m, --machine
string
Name or ID of the machine to create the volume on. If not specified and there are multiple machines, you’ll be prompted to select one.

Examples

Create a simple volume

If you have one machine, this creates the volume on that machine:
uc volume create postgres-data
If you have multiple machines, you’ll be prompted:
Select a machine to create the volume on (or specify with --machine flag)
> vps1
  vps2
  vps3

Create a volume on a specific machine

uc volume create postgres-data -m vps1

Create a volume with labels

uc volume create app-data -l environment=production -l team=backend

Create a volume with driver options

For advanced storage configurations:
uc volume create app-data -o type=nfs -o device=nfs-server:/path

Output

Volume 'postgres-data' created on machine 'vps1'.

Volume Drivers

Local Driver (default)

Stores data in a directory on the machine’s filesystem:
uc volume create mydata -d local

Other Drivers

You can use other Docker volume drivers if they’re installed on the machine:
uc volume create mydata -d nfs

Machine Selection

Volumes are created on a specific machine and can only be used by containers on that machine. When you mount a volume in a service:
uc run postgres:16 -v postgres-data:/var/lib/postgresql/data
Containers will be scheduled only on machines where the postgres-data volume exists.

Use Cases

Database Storage

Create a volume for database data:
uc volume create postgres-data -m db-machine
uc run postgres:16 -v postgres-data:/var/lib/postgresql/data

Application Data

Create a volume for uploaded files:
uc volume create uploads -m vps1
uc run myapp:latest -v uploads:/app/uploads

Shared Configuration

Create a volume for configuration files:
uc volume create config -m vps1
uc run nginx:latest -v config:/etc/nginx/conf.d:ro

Important Notes

Machine-Specific

Volumes are tied to a specific machine. If that machine goes down, services using the volume cannot run on other machines. For high availability, consider:
  • Using replicated databases across multiple machines
  • Network-attached storage (NFS, cloud storage)
  • Backing up volumes regularly

Naming Constraints

Volume names must follow Docker naming rules:
# Valid
uc volume create my-data
uc volume create app_uploads
uc volume create db.backup

# Invalid
uc volume create my data  # No spaces
uc volume create app@data # No special characters (except -, _, .)

Build docs developers (and LLMs) love