DOCKER
Section: Docker User Manuals (1)
Updated: Jun 2025
Index
Return to Main Contents
NAME
docke-servic-create- Create a new service
SYNOPSIS
docker service create [OPTIONS] IMAGE [COMMAND] [ARG...]
DESCRIPTION
Create a new service
OPTIONS
-ca-add=
Add Linux capabilities
-ca-drop=
Drop Linux capabilities
-config=
Specify configurations to expose to the service
-constraint=
Placement constraints
-containe-label=
Container labels
-credentia-spec=
Credential spec for managed service account (Windows only)
-d, -detach[=false]
Exit immediately instead of waiting for the service to converge
-dns=
Set custom DNS servers
-dn-option=
Set DNS options
-dn-search=
Set custom DNS search domains
-endpoin-mode="vip"
Endpoint mode (vip or dnsrr)
-entrypoint=
Overwrite the default ENTRYPOINT of the image
-e, -env=
Set environment variables
-en-file=
Read in a file of environment variables
-generi-resource=
User defined resources
-group=
Set one or more supplementary user groups for the container
-healt-cmd=""
Command to run to check health
-healt-interval=
Time between running the check (ms|s|m|h)
-healt-retries=0
Consecutive failures needed to report unhealthy
-healt-star-interval=
Time between running the check during the start period (ms|s|m|h)
-healt-star-period=
Start period for the container to initialize before counting retries towards unstable (ms|s|m|h)
-healt-timeout=
Maximum time to allow one check to run (ms|s|m|h)
-host=
Set one or more custom hos-t-IP mappings (host:ip)
-hostname=""
Container hostname
-init[=false]
Use an init inside each service container to forward signals and reap processes
-isolation=""
Service container isolation mode
-l, -label=
Service labels
-limi-cpu=
Limit CPUs
-limi-memory=0
Limit Memory
-limi-pids=0
Limit maximum number of processes (default 0 = unlimited)
-lo-driver=""
Logging driver for service
-lo-opt=
Logging driver options
-ma-concurrent=
Number of job tasks to run concurrently (default equal to-replicas)
-mode="replicated"
Service mode ("replicated", "global", "replicate-job", "globa-job")
-mount=
Attach a filesystem mount to the service
-name=""
Service name
-network=
Network attachments
-n-healthcheck[=false]
Disable any containe-specified HEALTHCHECK
-n-resolv-image[=false]
Do not query the registry to resolve image digest and supported platforms
-oo-scor-adj=0
Tune host's OOM preferences -1000 to 1000)
-placemen-pref=
Add a placement preference
-p, -publish=
Publish a port as a node port
-q, -quiet[=false]
Suppress progress output
-rea-only[=false]
Mount the container's root filesystem as read only
-replicas=
Number of tasks
-replica-ma-pe-node=0
Maximum number of tasks per node (default 0 = unlimited)
-reserv-cpu=
Reserve CPUs
-reserv-memory=0
Reserve Memory
-restar-condition=""
Restart when condition is met ("none", "o-failure", "any") (default "any")
-restar-delay=
Delay between restart attempts (ns|us|ms|s|m|h) (default 5s)
-restar-ma-attempts=
Maximum number of restarts before giving up
-restar-window=
Window used to evaluate the restart policy (ns|us|ms|s|m|h)
-rollbac-delay=0s
Delay between task rollbacks (ns|us|ms|s|m|h) (default 0s)
-rollbac-failur-action=""
Action on rollback failure ("pause", "continue") (default "pause")
-rollbac-ma-failur-ratio=0
Failure rate to tolerate during a rollback (default 0)
-rollbac-monitor=0s
Duration after each task rollback to monitor for failure (ns|us|ms|s|m|h) (default 5s)
-rollbac-order=""
Rollback order ("star-first", "sto-first") (default "sto-first")
-rollbac-parallelism=1
Maximum number of tasks rolled back simultaneously (0 to roll back all at once)
-secret=
Specify secrets to expose to the service
-sto-grac-period=
Time to wait before force killing a container (ns|us|ms|s|m|h) (default 10s)
-sto-signal=""
Signal to stop the container
-sysctl=
Sysctl options
-t, -tty[=false]
Allocate a pseud-TTY
-ulimit=[]
Ulimit options
-updat-delay=0s
Delay between updates (ns|us|ms|s|m|h) (default 0s)
-updat-failur-action=""
Action on update failure ("pause", "continue", "rollback") (default "pause")
-updat-ma-failur-ratio=0
Failure rate to tolerate during an update (default 0)
-updat-monitor=0s
Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 5s)
-updat-order=""
Update order ("star-first", "sto-first") (default "sto-first")
-updat-parallelism=1
Maximum number of tasks updated simultaneously (0 to update all at once)
-u, -user=""
Username or UID (format: [:])
-wit-registr-auth[=false]
Send registry authentication details to swarm agents
-w, -workdir=""
Working directory inside the container
SEE ALSO
docke-service(1)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- SEE ALSO
-