流浪者 ssh 'private_key_path' 文件必须存在



在向上迁移时出现此错误

There are errors in the configuration of this machine. Please fix
the following errors and try again:
SSH:
* `private_key_path` file must exist: insecure_key

我如何设置私钥以便ssh进入使用vagrant ssh?我用的是Windows 7。

我的流浪文件

Vagrant.configure("2") do |config|
    config.vm.define "phusion" do |v|
        v.vm.provider "docker" do |d|
          d.cmd = ["/sbin/my_init", "--enable-insecure-key"]
          d.image = "phusion/baseimage"
          d.name = 'dockerizedvm'
          d.has_ssh = true
          #d.force_host_vm = true
        end
        v.ssh.port = 22
        v.ssh.username = 'root'
        v.ssh.private_key_path = 'insecure_key'
        v.vm.provision "shell", inline: "echo hello"
        #v.vm.synced_folder "./keys", "/vagrant"
    end
end

所以在我的情况下,我使用cygwin与windows,我收到:

* `private_key_path` file must exist: 
C:cygwin64homebasic.user/.vagrant.d/insecure_private_key

经过几分钟的调查,我意识到VAGRANT_HOME环境变量不合适,所以导出正确的环境变量可以解决这个问题:

VAGRANT_HOME=/cygdrive/c/Users/basic.user
export VAGRANT_HOME

insecure_key应该是包含SSH密钥的文件。该文件应该在vagrant up所在的文件夹中。以下是另一种选择:

curl -o insecure_key -fSL https://github.com/phusion/baseimage-docker/raw/master/image/insecure_key chmod 600 insecure_key vagrant ssh

最新更新