Can not login docker via ssh

1k views Asked by At

I built docker swarm on my MacOS (version: 10.12.2) by docker-machine command following the office doc https://docs.docker.com/swarm/install-w-machine/. I first create swarm-master and set its env variables, and it worked well, and then I continue to add swarm node swarm-agent-00, it also worked well. Then my Mac slowed down because of exhaustion of my memory. I restart my Mac by force to achieve the second swarm node swarm-agent-01. But when I return to start my swarm-master, it failed in the login step, I use optional -D to debug, and get the following log:

linzongshutekiMacBook-Air:~ root# docker-machine -D start swarm-master
Docker Machine Version:  0.8.2, build e18a919
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver virtualbox
Plugin server listening at address 127.0.0.1:65359
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
command=start machine=swarm-master
Starting "swarm-master"...
(swarm-master) Calling .GetState
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage showvminfo swarm-master --machinereadable
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | name="swarm-master"
(swarm-master) DBG | groups="/"
(swarm-master) DBG | ostype="Linux 2.6 / 3.x / 4.x (64-bit)"
(swarm-master) DBG | UUID="1c319a99-23bc-457c-85a2-8eb84a219e38"
(swarm-master) DBG | CfgFile="/var/root/.docker/machine/machines/swarm-master/swarm-master/swarm-master.vbox"
(swarm-master) DBG | SnapFldr="/var/root/.docker/machine/machines/swarm-master/swarm-master/Snapshots"
(swarm-master) DBG | LogFldr="/var/root/.docker/machine/machines/swarm-master/swarm-master/Logs"
(swarm-master) DBG | hardwareuuid="1c319a99-23bc-457c-85a2-8eb84a219e38"
(swarm-master) DBG | memory=1024
(swarm-master) DBG | pagefusion="off"
(swarm-master) DBG | vram=8
(swarm-master) DBG | cpuexecutioncap=100
(swarm-master) DBG | hpet="on"
(swarm-master) DBG | chipset="piix3"
(swarm-master) DBG | firmware="BIOS"
(swarm-master) DBG | cpus=1
(swarm-master) DBG | pae="on"
(swarm-master) DBG | longmode="on"
(swarm-master) DBG | triplefaultreset="off"
(swarm-master) DBG | apic="on"
(swarm-master) DBG | x2apic="off"
(swarm-master) DBG | cpuid-portability-level=0
(swarm-master) DBG | bootmenu="disabled"
(swarm-master) DBG | boot1="dvd"
(swarm-master) DBG | boot2="dvd"
(swarm-master) DBG | boot3="disk"
(swarm-master) DBG | boot4="none"
(swarm-master) DBG | acpi="on"
(swarm-master) DBG | ioapic="on"
(swarm-master) DBG | biosapic="apic"
(swarm-master) DBG | biossystemtimeoffset=0
(swarm-master) DBG | rtcuseutc="on"
(swarm-master) DBG | hwvirtex="on"
(swarm-master) DBG | nestedpaging="on"
(swarm-master) DBG | largepages="on"
(swarm-master) DBG | vtxvpid="on"
(swarm-master) DBG | vtxux="on"
(swarm-master) DBG | paravirtprovider="default"
(swarm-master) DBG | effparavirtprovider="kvm"
(swarm-master) DBG | VMState="poweroff"
(swarm-master) DBG | VMStateChangeTime="2016-12-27T02:22:44.927000000"
(swarm-master) DBG | monitorcount=1
(swarm-master) DBG | accelerate3d="off"
(swarm-master) Calling .Start
(swarm-master) DBG | accelerate2dvideo="off"
(swarm-master) DBG | teleporterenabled="off"
(swarm-master) DBG | teleporterport=0
(swarm-master) DBG | teleporteraddress=""
(swarm-master) DBG | teleporterpassword=""
(swarm-master) DBG | tracing-enabled="off"
(swarm-master) DBG | tracing-allow-vm-access="off"
(swarm-master) DBG | tracing-config=""
(swarm-master) DBG | autostart-enabled="off"
(swarm-master) DBG | autostart-delay=0
(swarm-master) DBG | defaultfrontend=""
(swarm-master) DBG | storagecontrollername0="SATA"
(swarm-master) DBG | storagecontrollertype0="IntelAhci"
(swarm-master) DBG | storagecontrollerinstance0="0"
(swarm-master) DBG | storagecontrollermaxportcount0="30"
(swarm-master) DBG | storagecontrollerportcount0="30"
(swarm-master) DBG | storagecontrollerbootable0="on"
(swarm-master) DBG | "SATA-0-0"="/var/root/.docker/machine/machines/swarm-master/boot2docker.iso"
(swarm-master) DBG | "SATA-ImageUUID-0-0"="c0f13743-4448-4636-ab6b-343c424223ff"
(swarm-master) DBG | "SATA-tempeject"="off"
(swarm-master) DBG | "SATA-IsEjected"="off"
(swarm-master) DBG | "SATA-1-0"="/var/root/.docker/machine/machines/swarm-master/disk.vmdk"
(swarm-master) DBG | "SATA-ImageUUID-1-0"="77fcc5a6-5c88-4d04-ba03-b1136afc3fbe"
(swarm-master) DBG | "SATA-2-0"="none"
(swarm-master) DBG | "SATA-3-0"="none"
(swarm-master) DBG | "SATA-4-0"="none"
(swarm-master) DBG | "SATA-5-0"="none"
(swarm-master) DBG | "SATA-6-0"="none"
(swarm-master) DBG | "SATA-7-0"="none"
(swarm-master) DBG | "SATA-8-0"="none"
(swarm-master) DBG | "SATA-9-0"="none"
(swarm-master) DBG | "SATA-10-0"="none"
(swarm-master) DBG | "SATA-11-0"="none"
(swarm-master) DBG | "SATA-12-0"="none"
(swarm-master) DBG | "SATA-13-0"="none"
(swarm-master) DBG | "SATA-14-0"="none"
(swarm-master) DBG | "SATA-15-0"="none"
(swarm-master) DBG | "SATA-16-0"="none"
(swarm-master) DBG | "SATA-17-0"="none"
(swarm-master) DBG | "SATA-18-0"="none"
(swarm-master) DBG | "SATA-19-0"="none"
(swarm-master) DBG | "SATA-20-0"="none"
(swarm-master) DBG | "SATA-21-0"="none"
(swarm-master) DBG | "SATA-22-0"="none"
(swarm-master) DBG | "SATA-23-0"="none"
(swarm-master) DBG | "SATA-24-0"="none"
(swarm-master) DBG | "SATA-25-0"="none"
(swarm-master) DBG | "SATA-26-0"="none"
(swarm-master) DBG | "SATA-27-0"="none"
(swarm-master) DBG | "SATA-28-0"="none"
(swarm-master) DBG | "SATA-29-0"="none"
(swarm-master) DBG | natnet1="nat"
(swarm-master) DBG | macaddress1="080027E0FEBA"
(swarm-master) DBG | cableconnected1="on"
(swarm-master) DBG | nic1="nat"
(swarm-master) DBG | nictype1="82540EM"
(swarm-master) DBG | nicspeed1="0"
(swarm-master) DBG | mtu="0"
(swarm-master) DBG | sockSnd="64"
(swarm-master) DBG | sockRcv="64"
(swarm-master) DBG | tcpWndSnd="64"
(swarm-master) DBG | tcpWndRcv="64"
(swarm-master) DBG | Forwarding(0)="ssh,tcp,127.0.0.1,52348,,22"
(swarm-master) DBG | hostonlyadapter2="vboxnet0"
(swarm-master) DBG | macaddress2="0800275C28CA"
(swarm-master) DBG | cableconnected2="on"
(swarm-master) DBG | nic2="hostonly"
(swarm-master) DBG | nictype2="82540EM"
(swarm-master) DBG | nicspeed2="0"
(swarm-master) DBG | nic3="none"
(swarm-master) DBG | nic4="none"
(swarm-master) DBG | nic5="none"
(swarm-master) DBG | nic6="none"
(swarm-master) DBG | nic7="none"
(swarm-master) DBG | nic8="none"
(swarm-master) DBG | hidpointing="ps2mouse"
(swarm-master) DBG | hidkeyboard="ps2kbd"
(swarm-master) DBG | uart1="off"
(swarm-master) DBG | uart2="off"
(swarm-master) DBG | uart3="off"
(swarm-master) DBG | uart4="off"
(swarm-master) DBG | lpt1="off"
(swarm-master) DBG | lpt2="off"
(swarm-master) DBG | audio="none"
(swarm-master) DBG | clipboard="disabled"
(swarm-master) DBG | draganddrop="disabled"
(swarm-master) DBG | vrde="off"
(swarm-master) DBG | usb="off"
(swarm-master) DBG | ehci="off"
(swarm-master) DBG | xhci="off"
(swarm-master) DBG | SharedFolderNameMachineMapping1="Users"
(swarm-master) DBG | SharedFolderPathMachineMapping1="/Users"
(swarm-master) DBG | vcpenabled="off"
(swarm-master) DBG | vcpscreens=0
(swarm-master) DBG | vcpfile="/var/root/.docker/machine/machines/swarm-master/swarm-master/swarm-master.webm"
(swarm-master) DBG | vcpwidth=1024
(swarm-master) DBG | vcpheight=768
(swarm-master) DBG | vcprate=512
(swarm-master) DBG | vcpfps=25
(swarm-master) DBG | GuestMemoryBalloon=0
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
...
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage list hostonlyifs
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | Name:            vboxnet0
(swarm-master) DBG | GUID:            786f6276-656e-4074-8000-0a0027000000
(swarm-master) DBG | DHCP:            Disabled
(swarm-master) DBG | IPAddress:       192.168.99.1
(swarm-master) DBG | NetworkMask:     255.255.255.0
(swarm-master) DBG | IPV6Address:     
(swarm-master) DBG | IPV6NetworkMaskPrefixLength: 0
(swarm-master) DBG | HardwareAddress: 0a:00:27:00:00:00
(swarm-master) DBG | MediumType:      Ethernet
(swarm-master) DBG | Status:          Up
(swarm-master) DBG | VBoxNetworkName: HostInterfaceNetworking-vboxnet0
(swarm-master) DBG | 
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | Searching for hostonly interface for IPv4: 192.168.99.1 and Mask: ffffff00
(swarm-master) DBG | Found: vboxnet0
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage list dhcpservers
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | NetworkName:    HostInterfaceNetworking-vboxnet0
(swarm-master) DBG | IP:             192.168.99.6
(swarm-master) DBG | NetworkMask:    255.255.255.0
(swarm-master) DBG | lowerIPAddress: 192.168.99.100
(swarm-master) DBG | upperIPAddress: 192.168.99.254
(swarm-master) DBG | Enabled:        Yes
(swarm-master) DBG | 
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | Removing orphan DHCP servers...
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage list hostonlyifs
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | Name:            vboxnet0
(swarm-master) DBG | GUID:            786f6276-656e-4074-8000-0a0027000000
(swarm-master) DBG | DHCP:            Disabled
(swarm-master) DBG | IPAddress:       192.168.99.1
(swarm-master) DBG | NetworkMask:     255.255.255.0
(swarm-master) DBG | IPV6Address:     
(swarm-master) DBG | IPV6NetworkMaskPrefixLength: 0
(swarm-master) DBG | HardwareAddress: 0a:00:27:00:00:00
(swarm-master) DBG | MediumType:      Ethernet
(swarm-master) DBG | Status:          Up
(swarm-master) DBG | VBoxNetworkName: HostInterfaceNetworking-vboxnet0
(swarm-master) DBG | 
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | Adding/Modifying DHCP server "192.168.99.6"...
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage list dhcpservers
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | NetworkName:    HostInterfaceNetworking-vboxnet0
(swarm-master) DBG | IP:             192.168.99.6
(swarm-master) DBG | NetworkMask:    255.255.255.0
(swarm-master) DBG | lowerIPAddress: 192.168.99.100
(swarm-master) DBG | upperIPAddress: 192.168.99.254
(swarm-master) DBG | Enabled:        Yes
(swarm-master) DBG | 
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage modifyvm swarm-master --nic2 hostonly --nictype2 82540EM --nicpromisc2 deny --hostonlyadapter2 vboxnet0 --cableconnected2 on
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage modifyvm swarm-master --natpf1 delete ssh
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage modifyvm swarm-master --natpf1 ssh,tcp,127.0.0.1,52348,,22
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | COMMAND: /usr/local/bin/VBoxManage startvm swarm-master --type headless
(swarm-master) DBG | STDOUT:
(swarm-master) DBG | {
(swarm-master) DBG | Waiting for VM "swarm-master" to power on...
(swarm-master) DBG | VM "swarm-master" has been successfully started.
(swarm-master) DBG | }
(swarm-master) DBG | STDERR:
(swarm-master) DBG | {
(swarm-master) DBG | }
(swarm-master) DBG | Checking vm logs: /var/root/.docker/machine/machines/swarm-master/swarm-master/Logs/VBox.log
(swarm-master) Waiting for an IP...
(swarm-master) DBG | Getting to WaitForSSH function...
(swarm-master) DBG | Using SSH client type: external
(swarm-master) DBG | Using SSH private key: /var/root/.docker/machine/machines/swarm-master/id_rsa (-rw-------)
(swarm-master) DBG | &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none [email protected] -o IdentitiesOnly=yes -i /var/root/.docker/machine/machines/swarm-master/id_rsa -p 52348] /usr/bin/ssh <nil>}
(swarm-master) DBG | About to run SSH command:
(swarm-master) DBG | exit 0
(swarm-master) DBG | SSH cmd err, output: exit status 255: 
(swarm-master) DBG | Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
(swarm-master) DBG | command : exit 0
(swarm-master) DBG | err     : exit status 255
(swarm-master) DBG | output  : 
(swarm-master) DBG | 
(swarm-master) DBG | Getting to WaitForSSH function...
(swarm-master) DBG | Using SSH client type: external
(swarm-master) DBG | Using SSH private key: /var/root/.docker/machine/machines/swarm-master/id_rsa (-rw-------)
(swarm-master) DBG | &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none [email protected] -o IdentitiesOnly=yes -i /var/root/.docker/machine/machines/swarm-master/id_rsa -p 52348] /usr/bin/ssh <nil>}
(swarm-master) DBG | About to run SSH command:
(swarm-master) DBG | exit 0
(swarm-master) DBG | SSH cmd err, output: exit status 255: 
(swarm-master) DBG | Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
(swarm-master) DBG | command : exit 0
(swarm-master) DBG | err     : exit status 255
(swarm-master) DBG | output  : 

The shell was continuing Getting to WaitForSSH function... and return Error getting ssh command 'exit 0' : Something went wrong running an SSH command! and finally exit with error message Too many retries waiting for SSH to be available. Last error: Maximum number of retries (60) exceeded.

But machine was running with empty URL, Then I try the other two swarm node, and they logged in successfully and can be activated as well. Here are machine lists (the agent-01 was stopped due to lack of memory):

linzongshutekiMacBook-Air:~ root# docker-machine ls
NAME             ACTIVE      DRIVER       STATE     URL                         SWARM                   DOCKER    ERRORS
default          -           virtualbox   Stopped                                                       Unknown   
local            -           virtualbox   Stopped                                                       Unknown   
swarm-agent-00   -           virtualbox   Running   tcp://192.168.99.102:2376   swarm-master            v1.12.5   
swarm-agent-01   -           virtualbox   Stopped                               swarm-master            Unknown   
swarm-master     * (swarm)   virtualbox   Running                               swarm-master (master)   Unknown   Something went wrong running an SSH command!
command : ip addr show
err     : exit status 255
output  : 

By viewing the log above, I found there was a step to log in localhost by SSH, then I run the command directly in terminal with log info, and outputs are:

linzongshutekiMacBook-Air:~ root# ssh -o PasswordAuthentication=no -i /var/root/.docker/machine/machines/swarm-master/id_rsa -p 52348 [email protected] -vvv
OpenSSH_7.3p1, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "127.0.0.1" port 52348
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 52348.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /var/root/.docker/machine/machines/swarm-master/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/root/.docker/machine/machines/swarm-master/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2
debug1: match: OpenSSH_7.2 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 127.0.0.1:52348 as 'docker'
debug3: put_host_port: [127.0.0.1]:52348
debug3: hostkeys_foreach: reading file "/var/root/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /var/root/.ssh/known_hosts:67
debug3: load_hostkeys: loaded 1 keys from [127.0.0.1]:52348
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:suSnsokwsrM9SiXN+LGUnF+3h698gOhqaQqGQBsECiY
debug3: put_host_port: [127.0.0.1]:52348
debug3: put_host_port: [127.0.0.1]:52348
debug3: hostkeys_foreach: reading file "/var/root/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /var/root/.ssh/known_hosts:67
debug3: load_hostkeys: loaded 1 keys from [127.0.0.1]:52348
debug1: Host '[127.0.0.1]:52348' is known and matches the ECDSA host key.
debug1: Found key in /var/root/.ssh/known_hosts:67
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug2: key: /var/root/.docker/machine/machines/swarm-master/id_rsa (0x7f93e9410560), explicit
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/root/.docker/machine/machines/swarm-master/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: 
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey,password,keyboard-interactive).

The I googled around and someone said these log don't have anything useful, it should to refer logs of sshd in remote server. It make me confused because I didn't even found a log of ssh from my Mac, and I didn't know how to go on debug?

Of course, I can remove the master machine and create a new one, but it is better for me to find the reason. Can someone tell me what's the problem and how to fix it? More details about how docker processing docker user log in maybe so much the better. Thank you very much!

1

There are 1 answers

0
Zongshu Lin On

With more search and debug, I found docker-machine is a linux liked virtual machine (not very exactly), and it also contains users and auth users, the following question show that password of docker user is tcuser, and I tried it, it logged successfully:

ssh -p 52348 [email protected]

Reference: How do I SSH into the boot2docker host vm that the Vagrant 1.6 Docker Provider sets up?

Then I found /home/docker donot contain .ssh file, so I copy the public key by following commands in local terminal:

ssh-copy-id -i /var/root/.docker/machine/machines/swarm-master/id_rsa.pub -p 52348 [email protected]

Then it can be logged by:

ssh -i /var/root/.docker/machine/machines/swarm-master/id_rsa.pub -p 52348 [email protected]

But certs need to regenerated before you set docker environment variables:

docker-machine regenerate-certs swarm-master
eval "$(docker-machine env swarm-master)"

Finally, swarm-master running well:

$ docker-machine ls
NAME             ACTIVE   DRIVER       STATE     URL                         SWARM                   DOCKER    ERRORS
...
swarm-agent-01   -        virtualbox   Running   tcp://192.168.99.103:2376       swarm-master            v1.12.5   
swarm-master     *        virtualbox   Running   tcp://192.168.99.101:2376   swarm-master (master)   v1.12.5 

But, it came across a new question, the .ssh folder will be removed each time swarm-master restart, then I need to redo the above operation to make it work, can some one show me why, and how can I resolve the problem thoroughly?