Vagrant ssh'private_key_path`文件必须存在

Dar*_*Var 5 vagrant

流浪汉期间我收到此错误

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
Run Code Online (Sandbox Code Playgroud)

如何设置私钥以便使用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
Run Code Online (Sandbox Code Playgroud)

Adr*_*n H 8

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

* `private_key_path` file must exist: 
C:\cygwin64\home\basic.user/.vagrant.d/insecure_private_key
Run Code Online (Sandbox Code Playgroud)

经过几分钟的调查后,我意识到VAGRANT_HOME环境变量不正常,因此导出正确的环境变量完成了这项工作:

VAGRANT_HOME=/cygdrive/c/Users/basic.user
export VAGRANT_HOME
Run Code Online (Sandbox Code Playgroud)


ivo*_*ron 2

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