Linux command
docker-service 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create a service
docker service create --name [name] [image]
List services
docker service ls
Inspect a service
docker service inspect [service]
Scale a service
docker service scale [service]=[replicas]
Update service image
docker service update --image [image]:[tag] [service]
View service logs
docker service logs [service]
Remove a service
docker service rm [service]
说明
docker service manages Swarm services. A service is a declaration of how a set of containers should run across a swarm: image, replica count, networks, mounts, secrets, resource limits, and update strategy. The swarm orchestrator schedules tasks (container instances) on cluster nodes and maintains the desired state, replacing failed tasks and routing traffic via the routing mesh. Service commands are only available on a Docker host participating in a swarm; initialize one with docker swarm init before using them. Updates are applied as rolling updates by default, with rollback available to revert to the previous service spec.
FAQ
What is the docker-service command used for?
docker service manages Swarm services. A service is a declaration of how a set of containers should run across a swarm: image, replica count, networks, mounts, secrets, resource limits, and update strategy. The swarm orchestrator schedules tasks (container instances) on cluster nodes and maintains the desired state, replacing failed tasks and routing traffic via the routing mesh. Service commands are only available on a Docker host participating in a swarm; initialize one with docker swarm init before using them. Updates are applied as rolling updates by default, with rollback available to revert to the previous service spec.
How do I run a basic docker-service example?
Run `docker service create --name [name] [image]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more docker-service examples?
This page includes 7 examples for docker-service, plus related commands for nearby Linux tasks.