84.1k views
1 vote
How do you initialize a Docker Swarm in order to make it ready to add nodes and services?

A) docker swarm init --advertise-addr

B) docker start swarm --init

C) docker create swarm --initialize

D) docker init swarm --start

1 Answer

7 votes

Final answer:

To initialize a Docker Swarm, you can use the command 'docker swarm init --advertise-addr' followed by the IP address you want to advertise. After initialization, you can add nodes and services to the Swarm.

Step-by-step explanation:

The correct command to initialize a Docker Swarm is docker swarm init --advertise-addr. This command initializes a new Docker Swarm, creates a token for node joining, and assigns the specified address as the advertise address.

For example, if you want to advertise the address 192.168.0.10, you would use the command docker swarm init --advertise-addr 192.168.0.10.

Once the Swarm is initialized, you can add nodes and services to it using the appropriate Docker Swarm commands.

User Allenwei
by
7.9k points