mirror of https://github.com/docker/docs.git
Explain ports 2376 and 2377 (#4677)
This commit is contained in:
parent
34d55ca951
commit
415b13526f
|
@ -67,35 +67,41 @@ machine a swarm manager. From then on, Docker will run the commands you execute
|
||||||
on the swarm you're managing, rather than just on the current machine.
|
on the swarm you're managing, rather than just on the current machine.
|
||||||
|
|
||||||
{% capture local-instructions %}
|
{% capture local-instructions %}
|
||||||
You now have two VMs created, named `myvm1` and `myvm2` (as `docker-machine ls`
|
You now have two VMs created, named `myvm1` and `myvm2`:
|
||||||
shows). The first one will act as the manager, which executes `docker` commands
|
|
||||||
and authenticates workers to join the swarm, and the second will be a worker.
|
```shell
|
||||||
|
docker-machine ls
|
||||||
|
```
|
||||||
|
|
||||||
|
The first one will act as the manager, which executes management commands and
|
||||||
|
authenticates workers to join the swarm, and the second will be a worker.
|
||||||
|
|
||||||
You can send commands to your VMs using `docker-machine ssh`. Instruct `myvm1`
|
You can send commands to your VMs using `docker-machine ssh`. Instruct `myvm1`
|
||||||
to become a swarm manager with `docker swarm init` and you'll see output like
|
to become a swarm manager with `docker swarm init` and you'll see output like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ docker-machine ssh myvm1 "docker swarm init"
|
$ docker-machine ssh myvm1 "docker swarm init --advertise-addr <myvm1 ip>"
|
||||||
Swarm initialized: current node <node ID> is now a manager.
|
Swarm initialized: current node <node ID> is now a manager.
|
||||||
|
|
||||||
To add a worker to this swarm, run the following command:
|
To add a worker to this swarm, run the following command:
|
||||||
|
|
||||||
docker swarm join \
|
docker swarm join \
|
||||||
--token <token> \
|
--token <token> \
|
||||||
<ip>:<port>
|
<myvm ip>:<port>
|
||||||
|
|
||||||
|
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
|
||||||
```
|
```
|
||||||
|
|
||||||
> Got an error about needing to use `--advertise-addr`?
|
> **Note**: Ports 2376 and 2377
|
||||||
>
|
> Port 2376 is the Docker daemon port. Port 2377 is the swarm management port.
|
||||||
> Copy the
|
> Run `docker swarm init` and `docker swarm join` with port 2377 or no port at
|
||||||
> IP address for `myvm1` by running `docker-machine ls`, then run the
|
> all.
|
||||||
> `docker swarm init` command again, using that IP and specifying port `2377`
|
|
||||||
> (the port for swarm joins) with `--advertise-addr`. For example:
|
> The VM URLs returned by`docker-machine ls` include port 2376. Do not use this
|
||||||
>
|
> port or [you may experience errors](https://forums.docker.com/t/docker-swarm-join-with-virtualbox-connection-error-13-bad-certificate/31392/2).
|
||||||
> ```
|
|
||||||
> docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.100:2377"
|
> To start over, run `docker swarm leave` from each node.
|
||||||
> ```
|
|
||||||
|
|
||||||
As you can see, the response to `docker swarm init` contains a pre-configured
|
As you can see, the response to `docker swarm init` contains a pre-configured
|
||||||
`docker swarm join` command for you to run on any nodes you want to add. Copy
|
`docker swarm join` command for you to run on any nodes you want to add. Copy
|
||||||
|
@ -105,14 +111,14 @@ join your new swarm as a worker:
|
||||||
```shell
|
```shell
|
||||||
$ docker-machine ssh myvm2 "docker swarm join \
|
$ docker-machine ssh myvm2 "docker swarm join \
|
||||||
--token <token> \
|
--token <token> \
|
||||||
<ip>:<port>"
|
<ip>:2377"
|
||||||
|
|
||||||
This node joined a swarm as a worker.
|
This node joined a swarm as a worker.
|
||||||
```
|
```
|
||||||
|
|
||||||
Congratulations, you have created your first swarm.
|
Congratulations, you have created your first swarm.
|
||||||
|
|
||||||
> **Note**: You can also run `docker-machine ssh myvm2` with no command attached
|
> **Note**: You can also run `docker-machine ssh myvm1` with no command attached
|
||||||
to open a terminal session on that VM. Type `exit` when you're ready to return
|
to open a terminal session on that VM. Type `exit` when you're ready to return
|
||||||
to the host shell prompt. It may be easier to paste the join command in that
|
to the host shell prompt. It may be easier to paste the join command in that
|
||||||
way.
|
way.
|
||||||
|
|
Loading…
Reference in New Issue