运行一个十分简单的例子:
Vagrant.configure(2) do |config| config.vm.provider "docker" do |d| d.image = "hello-world" d.has_ssh = true end # use shell and other provisioners as usual config.vm.provision "shell", inline: "echo 'hello docker!'" end
按照前面学的知识应该是能够跑通的,但是就是会一直卡在:
userdeMacBook-Pro:test-1 user$ vagrant up Bringing machine 'default' up with 'docker' provider... ==> default: Fixed port collision for 22 => 2222. Now on port 2201. ==> default: Creating the container... default: Name: test-1_default_1545915326 default: Image: hello-world default: Volume: /Users/user/test-1:/vagrant default: Port: 127.0.0.1:2201:22 default: default: Container created: 1243ad705a6cd5d4 ==> default: Starting container... ==> default: Waiting for machine to boot. This may take a few minutes...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
然后容器也没有运行起来,这是为什么呢,有知道原因的小伙伴希望能够告知,还运行了一些其他的例子,感觉都没有真正的运行起来