• 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

  • 相关阅读:
    vi编辑器命令大全
    Ubuntu环境搭建svn服务器
    Visual Studio中“后期生成事件命令行” 中使用XCopy命令
    解决 Visual Studio For Mac 还原包失败问题
    [Win10应用开发] 如何使用Windows通知
    [Win10应用开发] 使用 Windows 推送服务
    如何使用 PsExec 执行远程命令
    如何在调试Window App时,触发 Suspending ,Resuming 等事件
    如何 “解决” WPF中空域问题(Airspace issuse)
    浅谈可扩展性框架:MEF
  • 原文地址:https://www.cnblogs.com/felixwa/p/8081187.html
Copyright © 2020-2023  润新知