docker-service-create - Man Page

Create a new service


docker service create [Options] IMAGE [COMMAND] [ARG...]


Create a new service



Specify configurations to expose to the service


Placement constraints


Container labels


Credential spec for managed service account (Windows only)

-d,  --detach[=false]

Exit immediately instead of waiting for the service to converge


Set custom DNS servers


Set DNS options


Set custom DNS search domains


Endpoint mode (vip or dnsrr)


Overwrite the default ENTRYPOINT of the image

-e,  --env=

Set environment variables


Read in a file of environment variables


User defined resources


Set one or more supplementary user groups for the container


Command to run to check health


Time between running the check (ms|s|m|h)


Consecutive failures needed to report unhealthy


Start period for the container to initialize before counting retries towards unstable (ms|s|m|h)


Maximum time to allow one check to run (ms|s|m|h)

-h,  --help[=false]

help for create


Set one or more custom host-to-IP mappings (host:ip)


Container hostname


Use an init inside each service container to forward signals and reap processes


Service container isolation mode

-l,  --label=

Service labels


Limit CPUs


Limit Memory


Logging driver for service


Logging driver options


Service mode (replicated or global)


Attach a filesystem mount to the service


Service name


Network attachments


Disable any container-specified HEALTHCHECK


Do not query the registry to resolve image digest and supported platforms


Add a placement preference

-p,  --publish=

Publish a port as a node port

-q,  --quiet[=false]

Suppress progress output


Mount the container's root filesystem as read only


Number of tasks


Maximum number of tasks per node (default 0 = unlimited)


Reserve CPUs


Reserve Memory


Restart when condition is met ("none"|"on-failure"|"any") (default "any")


Delay between restart attempts (ns|us|ms|s|m|h) (default 5s)


Maximum number of restarts before giving up


Window used to evaluate the restart policy (ns|us|ms|s|m|h)


Delay between task rollbacks (ns|us|ms|s|m|h) (default 0s)


Action on rollback failure ("pause"|"continue") (default "pause")


Failure rate to tolerate during a rollback (default 0)


Duration after each task rollback to monitor for failure (ns|us|ms|s|m|h) (default 5s)


Rollback order ("start-first"|"stop-first") (default "stop-first")


Maximum number of tasks rolled back simultaneously (0 to roll back all at once)


Specify secrets to expose to the service


Time to wait before force killing a container (ns|us|ms|s|m|h) (default 10s)


Signal to stop the container


Sysctl options

-t,  --tty[=false]

Allocate a pseudo-TTY


Delay between updates (ns|us|ms|s|m|h) (default 0s)


Action on update failure ("pause"|"continue"|"rollback") (default "pause")


Failure rate to tolerate during an update (default 0)


Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 5s)


Update order ("start-first"|"stop-first") (default "stop-first")


Maximum number of tasks updated simultaneously (0 to update all at once)

-u,  --user=""

Username or UID (format: <name|uid>[:<group|gid>])


Send registry authentication details to swarm agents

-w,  --workdir=""

Working directory inside the container

See Also


Referenced By


May 2020 Docker Community