V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ruandao
V2EX  ›  问与答

docker-machine 无法连接

  •  
  •   ruandao · 2020-03-01 01:19:34 +08:00 · 749 次点击
    这是一个创建于 1543 天前的主题,其中的信息可能已经有所发展或是发生改变。

    mac 上创建远程 docker-machine

    创建

    docker-machine create --driver generic --generic-ip-address=192.168.1.221 --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user yan centos
    
    
    Running pre-create checks...
    Creating machine...
    (centos) Importing SSH key...
    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 centos...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Setting Docker configuration on the remote daemon...
    Checking connection to Docker...
    Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.1.221:2376": dial tcp 192.168.1.221:2376: connect: connection refused
    You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
    Be advised that this will trigger a Docker daemon restart which might stop running containers.
    
    
    
    $ docker-machine regenerate-certs centos
    Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): y
    Regenerating TLS certificates
    Waiting for SSH to be available...
    Detecting the provisioner...
    Copying certs to the local machine directory...
    Copying certs to the remote machine...
    Setting Docker configuration on the remote daemon...
    

    显示状态

    docker-machine ls
    centos     -        generic      Running   tcp://192.168.1.221:2376            Unknown    Unable to query docker version: Cannot connect to the docker engine endpoint
    

    局域网的 docker:

    [yan@centos ~]$ docker version
    Client: Docker Engine - Community
    Version:           19.03.6
    API version:       1.40
    Go version:        go1.12.16
    Git commit:        369ce74a3c
    Built:             Thu Feb 13 01:29:29 2020
    OS/Arch:           linux/amd64
    Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          19.03.6
      API version:      1.40 (minimum version 1.12)
      Go version:       go1.12.16
      Git commit:       369ce74a3c
      Built:            Thu Feb 13 01:28:07 2020
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          1.2.10
      GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
     runc:
      Version:          1.0.0-rc8+dev
      GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
     docker-init:
      Version:          0.18.0
      GitCommit:        fec3683
    

    家里的局域网的一台 centos 然后我手头上的是 mac air (因为容量性能不够,所以准备把一些 docker 的相关实验放 centos 上) 目前创建 docker-machine 出问题了 有点不知道如何下手

    谢谢

    第 1 条附言  ·  2020-03-01 12:48:36 +08:00
    问题解决了

    firewalld 阻止了 2376 端口的连接

    打开了就 ok 了,不过在考虑要不要把 firewalld 关闭掉

    https://www.digitalocean.com/community/tutorials/how-to-configure-the-linux-firewall-for-docker-swarm-on-centos-7
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1019 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:09 · PVG 06:09 · LAX 15:09 · JFK 18:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.