zoukankan      html  css  js  c++  java
  • docker-machine: Error creating machine: Error running provisioning: ssh command error

    问题描述:

    当我使用docker-machine安装docker到另一台电脑的时候,遇到这个问题:

    [felix@felix ~]$ docker-machine create --driver generic --generic-ssh-user felix  --generic-ip-address=172.125.1.71 host1
    Running pre-create checks...
    Creating machine...
    (host1) No SSH key specified. Assuming an existing key at the default location.
    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 ubuntu(systemd)...
    Error creating machine: Error running provisioning: ssh command error:
    command : sudo hostname host1 && echo "host1" | sudo tee /etc/hostname
    err     : exit status 1
    output  : sudo: no tty present and no askpass program specified

    解决:

    根据问题描述可以知道docker-machine登陆到host1,并且在host1上进行操作:sudo hostname host1 && echo "host1" | sudo tee /etc/hostname。于是我手动登陆到host1上进行操作,发现提示sudo的密码。

    问题出现在从docker-machine登陆到host1上进行sudo操作却无法知道sudo密码。

    解决办法是设置host1上登陆用户使用sudo时候不需要密码

    设置方面如下:

    1) 在host1运行 sudo visudo

    2)在打开文件最后添加  username(felix) ALL=(ALL) NOPASSWD: ALL

    3) 退出

    再次运行docker-machine:

    [felix@felix ~]$ docker-machine create --driver generic --generic-ssh-user felix  --generic-ip-address=172.125.1.71 host1
    Running pre-create checks...
    Creating machine...
    (host1) No SSH key specified. Assuming an existing key at the default location.
    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 ubuntu(systemd)...
    Installing Docker...
    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 host1

  • 相关阅读:
    uva 816
    SQL语言类
    VTK中国文字显示和简单的医疗图像浏览软件
    系统开始了解--感兴趣的文章
    的天数,以一个日期与当前日期的
    POJ 2528 QAQ段树+分离
    IT该忍者神龟Instant client required
    进程和线程之间的通信
    2014——我的求职(两)
    如何绕过chrome的弹窗拦截机制
  • 原文地址:https://www.cnblogs.com/felixwa/p/8081187.html
Copyright © 2011-2022 走看看