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

  • 相关阅读:
    Nginx编译安装
    Docker下mysql容器开启binlog日志(保留7天)
    podman
    error: audit:backlog limit exceeded
    64位win2003/win2008系统IIS6.0/7.5配置PHP的方法
    iis7.5安装配置php环境详细清晰教程,三步实现【图文】
    Windows下IIS+PHP 5.2的安装与配置
    无线路由MAC地址过滤安全可靠性讨论
    debian flam3 源码
    debian flam3 依赖文件
  • 原文地址:https://www.cnblogs.com/felixwa/p/8081187.html
Copyright © 2011-2022 走看看