docker run but for the entire cluster.
Usage
Arguments
Container image to run (for example,
nginx:latest or postgres:16).Override the default command of the container image.
Flags
Path to a custom Caddy config (Caddyfile) for the service. Cannot be used together with non-@host published ports.
Maximum number of CPU cores a service container can use. Fractional values are allowed, like
0.5 for half a core or 2.25 for two and a quarter cores.Overwrite the default ENTRYPOINT of the image. Pass an empty string
"" to reset it.Set an environment variable for service containers. Can be specified multiple times.Format:
VAR=value or just VAR to use the value from the local environment.Replication mode of the service:
replicated- A specified number of containers across the machinesglobal- One container on every machine
Placement constraint by machine names, limiting which machines the service can run on. Can be specified multiple times or as a comma-separated list. Default is any suitable machine.
Maximum amount of memory a service container can use. Value is a positive integer with optional unit suffix (b, k, m, g). Default unit is bytes if no suffix specified.Examples:
1073741824, 1024m, 1g (all equal 1 gibibyte)Assign a name to the service. A random name is generated if not specified.
--privileged
Give extended privileges to service containers. This is a security risk and should be used with caution.
Publish a service port to make it accessible outside the cluster. Can be specified multiple times.Format:
[hostname:]container_port[/protocol] or [host_ip:]host_port:container_port[/protocol]@hostSupported protocols: tcp, udp, http, https (default is tcp)If a hostname for http(s) port is not specified and a cluster domain is reserved, service-name.cluster-domain will be used.Pull image from the registry before running service containers.Options:
always, missing, neverNumber of containers to run for the service. Only valid for a replicated service.
User name or UID and optionally group name or GID used for running the command inside service containers.Format:
USER[:GROUP] or UID[:GID]. If not specified, the user is set to the default user of the image.Mount a data volume or host path into service containers. Service containers will be scheduled on the machine(s) where the volume is located. Can be specified multiple times.Format:
volume_name:/container/path[:ro|volume-nocopy] or /host/path:/container/path[:ro]Examples
Run a simple web server
Run with a custom hostname
Run with environment variables
Run with resource limits
Run with a named volume
Run in global mode
One container on every machine:Run with multiple replicas
Run on specific machines
Run with host path mount
Run with custom entrypoint
Port Publishing Examples
HTTPS with automatic hostname
If you have a cluster domain reserved (likeabc123.uncld.dev), this will be accessible at servicename.abc123.uncld.dev:
HTTPS with custom hostname
Multiple ports
Host port binding
Bind container port 53 to host port 53 (UDP):Volume Mounting Examples
Named volume
Multiple volumes
Read-only volume
Host directory bind mount
Output
Related Commands
uc deploy- Deploy services from a Compose fileuc service ls- List servicesuc service scale- Scale a serviceuc service rm- Remove a service
