docker 문제 5: swarm에 Worker 버그를 추가합니다. 정보는 "Error response from daemon: rpc error: code = Unavailable desc ="

11082 단어 docker
공식 문서 part4의 예를 참조하여 워크맨 오류 메시지를 추가하는 전체 과정은 다음과 같습니다.
VM 2개 만들기
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine create --driver virtualbox myvm1
Running pre-create checks...
Creating machine...
(myvm1) Copying /Users/cappuccinooo/.docker/machine/cache/boot2docker.iso to /Users/cappuccinooo/.docker/machine/machines/myvm1/boot2docker.iso...
(myvm1) Creating VirtualBox VM...
(myvm1) Creating SSH key...
(myvm1) Starting the VM...
(myvm1) Check network to re-create if needed...
(myvm1) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm1
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine create --driver virtualbox myvm2
Running pre-create checks...
Creating machine...
(myvm2) Copying /Users/cappuccinooo/.docker/machine/cache/boot2docker.iso to /Users/cappuccinooo/.docker/machine/machines/myvm2/boot2docker.iso...
(myvm2) Creating VirtualBox VM...
(myvm2) Creating SSH key...
(myvm2) Starting the VM...
(myvm2) Check network to re-create if needed...
(myvm2) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env myvm2

VM 생성 보기
cappuccinooos-MacBook-Pro:~ cappuccinooo$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
myvm1   -        virtualbox   Running   tcp://192.168.99.100:2376           v18.05.0-ce
myvm2   -        virtualbox   Running   tcp://192.168.99.101:2376           v18.05.0-ce

Swarm 클러스터 관리자 만들기
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine ssh myvm1 "docker swarm init"
Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses on different interfaces (10.0.2.15 on eth0 and 192.168.99.100 on eth1) - specify one with --advertise-addr
exit status 1

공식 문서에 유사한 오류 메시지가 나타나면 IP 주소와 포트를 지정해야 하며 조정된 명령은 다음과 같습니다.
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.100:2377"
Swarm initialized: current node (56rvohie5wacjc9pt4y96pfbd) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-15dtlp88h8s12s6e76l8v3vtvj5rm32wor0rg36bjongv36qd3-82m58k6bp2dk2ugez1ksp5p2w 192.168.99.100:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

Swarm 관리자 생성 보기
cappuccinooos-MacBook-Pro:~ cappuccinooo$ docker-machine env myvm1
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/cappuccinooo/.docker/machine/machines/myvm1"
export DOCKER_MACHINE_NAME="myvm1"
# Run this command to configure your shell:
# eval $(docker-machine env myvm1)

창설이 성공했다는 것을 설명하는 관리자 정보를 볼 수 있습니다
Swarm 클러스터 Worker 작성
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-15dtlp88h8s12s6e76l8v3vtvj5rm32wor0rg36bjongv36qd3-82m58k6bp2dk2ugez1ksp5p2w 192.168.99.101:2377"
Error response from daemon: rpc error: code = Unavailable desc = grpc: the connection is unavailable
exit status 1

오류 원인을 조사한 결과 IP 주소를 잘못 썼습니다. 관리자의 IP 주소를 써야 합니다. 192.168.99.101을 192.168.99.100으로 바꾸면 문제가 해결됩니다. 아래와 같습니다.
cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-15dtlp88h8s12s6e76l8v3vtvj5rm32wor0rg36bjongv36qd3-82m58k6bp2dk2ugez1ksp5p2w 192.168.99.100:2377"
This node joined a swarm as a worker.

Swarm Worker 작성 보기
cappuccinooos-MacBook-Pro:~ cappuccinooo$ docker-machine env myvm2
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.101:2376"
export DOCKER_CERT_PATH="/Users/cappuccinooo/.docker/machine/machines/myvm2"
export DOCKER_MACHINE_NAME="myvm2"
# Run this command to configure your shell:
# eval $(docker-machine env myvm2)

좋은 웹페이지 즐겨찾기