docker service ls in a Docker Swarm cluster. What output will you see if there are two services named webapp and db running with 3 and 1 replicas respectively?docker service ls
The docker service ls command lists all services in the swarm. The webapp service is running in replicated mode with 3 replicas, so REPLICAS shows 3/3. The db service is also replicated with 1 replica. Option A correctly shows this state.
Self-healing means the orchestrator detects failed containers or nodes and automatically restarts or reschedules containers to keep the app running.
web service to run 5 replicas in a production swarm?In Docker Compose for swarm mode, scaling is set under deploy.replicas as a number. Option B correctly uses this syntax and a valid restart policy.
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: test-container
image: nginx
nodeSelector:
disktype: ssd
If no nodes have the label disktype=ssd, the scheduler cannot place the pod, so it stays Pending.
First update the manifest, then apply it to the cluster. Next, monitor the rollout to ensure pods update correctly. Finally, verify the new pods serve traffic without downtime.