Docker swarm join with virtualbox: connection error 13, bad certificate

Hello!
I’m working through “Get Started with Docker”, Part 4.
I created two machines, initialized swarm, tried to join worker node:

docker-machine create --driver virtualbox myvm1
docker-machine create --driver virtualbox myvm2
docker-machine ssh myvm1 “docker swarm init --advertise-addr 192.168.99.101:2376”
docker-machine ssh myvm2 “docker swarm join --token SWMTKN-1-65xbfd388nl61m4ip6qoplk0yqoze3qzq9ne9t00lmxbppt6oe-7f40hx9wn4tyu3b0nznsrqs2e 192.168.99.101:2376”

And got this error:

Error response from daemon: rpc error: code = 13 desc = connection error: desc = “transport: remote error: tls: bad certificate”

Can anyone help me with the issue?

OS Version/build Ubuntu 16.04 LTS
uname -a Linux ilya 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Virtualbox version 5.0.36_Ubuntur114008
Docker version

Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Mon Mar 27 17:14:09 2017
OS/Arch: linux/amd64

Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Mon Mar 27 17:14:09 2017
OS/Arch: linux/amd64
Experimental: false

Docker machine version 0.10.0, build 76ed2a6
docker.log on myvm2

time=“2017-04-23T06:50:22.387932257Z” level=debug msg=“Calling POST /v1.28/swarm/join”
time=“2017-04-23T06:50:22.388086237Z” level=debug msg=“form data: {"AdvertiseAddr":"","Availability":"","JoinToken":"*****","ListenAddr":"0.0.0.0:2377","RemoteAddrs":["192.168.99.101:2376"]}”
time=“2017-04-23T06:50:22.406343838Z” level=error msg=“failed to retrieve remote root CA certificate” error=“rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"” module=node
time=“2017-04-23T06:50:22.418908652Z” level=error msg=“failed to retrieve remote root CA certificate” error=“rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"” module=node
time=“2017-04-23T06:50:22.429897799Z” level=error msg=“failed to retrieve remote root CA certificate” error=“rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"” module=node
time=“2017-04-23T06:50:22.440172576Z” level=error msg=“failed to retrieve remote root CA certificate” error=“rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"” module=node
time=“2017-04-23T06:50:22.450112774Z” level=error msg=“failed to retrieve remote root CA certificate” error=“rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"” module=node
time=“2017-04-23T06:50:22.450163565Z” level=error msg=“cluster exited with error: rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"”
time=“2017-04-23T06:50:22.450212137Z” level=error msg=“Handler for POST /v1.28/swarm/join returned error: rpc error: code = 13 desc = connection error: desc = "transport: remote error: tls: bad certificate"”

1 Like

Port 2376 is the docker daemon port, not the swarmkit port. Use 2377 as the port if you want to explicitly specify it, or omit it entirely in your --advertise-addr command.

For example:

docker-machine ssh myvm1 "docker swarm leave --force"
docker-machine ssh myvm1 "docker swarm init --advertise-addr 192.168.99.101"
docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-65xbfd388nl61m4ip6qoplk0yqoze3qzq9ne9t00lmxbppt6oe-7f40hx9wn4tyu3b0nznsrqs2e 192.168.99.101"

(you’d of course end up needing to grab an actual fresh token after you re-init the cluster)

6 Likes

My fault :slight_smile: Thank you!

thanks! i meet the same error,and the answer of @programmerq is work

thanks! :grinning::grinning::grinning:

works!
thanks :slight_smile: