Show Menu
Cheatography

docker service Cheat Sheet (DRAFT) by

docker service create and update based on docker docs

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Usage (docker servic­e...)

...create [OPTIONS] IMAGE [COMMAND] [ARG...]
...inspect [OPTIONS] SERVICE [SERVICE...]
...logs [OPTIONS] SERVICE|TASK
...ls [OPTIONS]
...ps [OPTIONS] SERVICE [SERVICE...]
     --no-trunc       Do not truncate output
...rm SERVICE [SERVICE...]
...rollback [OPTIONS] SERVICE
...scale SERVICE=REPLICAS [SERVICE=REPLICAS...]
...update [OPTIONS] SERVICE

docker service create and update

--cons­traint (-add / -rm)
Placement constr­aints
--cont­ain­er-­label, (-add / -rm)
Container labels
--detach , -d
Run detached
--entr­ypoint
Overwrite entrypoint
--env , -e, --env-­file, (-add / -rm)
Enviro­nment variables
--label , -l, (-add / -rm)
Service labels
--limi­t-cpu, --limi­t-m­emory
Limit resources
--mount, (-add / -rm)
Volumes
--name (create only)
Service name
--network, (-add / -rm)
Network attach­ments
--publish , -p, (-add / -rm)
Publish a port as a node port
--replicas
Number of tasks
--repl­ica­s-m­ax-­per­-node
default=0
--rese­rve­-cpu, --rese­rve­-memory
Reserve resources
--secret, (-add / -rm)
Secrets attach­ments
--stop­-gr­ace­-period
Time before force killing
--stop­-signal
Signal to stop the container
--user , -u
Username or UID
--workdir , -w
Workdir
options "-add / -rm" are for docker update only
 

--cons­traint

node.id
node.i­d==­2iv­ku8­v2gvtg4
node.h­ostname
node.h­ost­nam­e!=­node-2
node.role
node.r­ole­==m­anager
node.l­abels
node.l­abe­ls.s­ec­uri­ty=­=high
engine.labels
engine.la­bel­s.o­per­ati­ngs­yst­em=­=ubuntu 14.04

--mount

type
volume, bind, tmpfs
src or source
dst or destin­ation or target
readonly or ro
true or 1 or no value / false or 0

--restart

-condition
“none”­|”o­n-f­ail­ure­”|”­any”, default “any”
-delay
between restart attempts, default 5s
-max-a­ttempts
before giving up
-window
Window used to evaluate

--rollback / --update

no option
Rollback to previous specif­ication (update only)
-delay
between task rollba­cks­/up­dates, default=0s
-failu­re-­action
“pause­”|”­con­tin­ue"|­"­rol­lback” ,defau­lt=­“pause”
-max-f­ail­ure­-ratio
default 0
-monitor
default 5s
-order
“start­-fi­rst­”|”­sto­p-f­irst”, defaul­t=“­sto­p-f­irst”
-paral­lelism
0 to rollba­ck/­update all at once