docker service ls

https://docs.docker.com/engine/reference/commandline/service_ls/

  • docker service ls [OPTIONS]
    —filter, -f 根据提供的条件过滤输出
    —quiet, -q 只显示ID
docker service ls -f "id=0bcjw"
docker service ls --filter label=project
docker service ls --filter mode=global
docker service ls --filter name=redis
docker service ls --filter label=project=project-a

docker service ps

https://docs.docker.com/engine/reference/commandline/service_ps/

docker service ps py_runbb -f "desired-state=shutdown" ##running shutdown accepted

docker service rm

https://docs.docker.com/engine/reference/commandline/service_rm/



labels管理

#打标签
docker node update --label-add nname=node1 worker1    #node.labels.nname == node1

docker service 短命令快捷方式

cat <<EOL >>~/.bashrc
alias dk='docker'
alias ds='docker service'
EOL
source ~/.bashrc