Which command is used to create a new service in Docker Swarm?

Prepare for the Docker Certified Associate test with our comprehensive quizzes that include key questions and detailed explanations. Ace your certification!

The command used to create a new service in Docker Swarm is "docker service create." This command is specifically designed for defining a new service within the Swarm orchestration platform. When you execute this command, you can specify various parameters such as the image to use, the number of replicas, network configurations, and resource constraints. The service creation is a fundamental operation in Docker Swarm, as it allows users to deploy and manage containerized applications effectively.

The other options do not serve this purpose. One option refers to starting a service, which is not a valid Docker command, as services are created and managed differently in Swarm. Another option mentions "docker swarm create," which is not a recognized command, as the proper command for initializing a Swarm is "docker swarm init." Lastly, "docker service up" is not a command in Docker; instead, "docker-compose up" is used in a different context for managing multi-container applications. By using "docker service create," you ensure that your desired service is correctly set up within the Swarm environment.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy