Thursday, April 14, 2022

Docker Swarm Service

 Docker Swarm service is used for managing the containers in the cluster

Step 1: Find the commands related to the docker swarm service

         docker service --help

Step 2: Create a service with a single replica with Nginx docker image ( by default docker service creates a single replica)

        docker service create --name myservice -d nginx

Step 3: Find the details of the service which is created above

         docker service ls

Step 4: To check where the container is running under this service

         docker service ps myservice

Step 5: Delete a service

         docker service rm myservice

Step 6: Create a service with multiple replicas

        docker service create --name webservice --replicas 3 -d nginx

Step 7: Scale-up replicas

         docker service scale webservice=5

Step 8: Scale down replicas

      docker service scale webservice=3






0 comments:

Post a Comment