vagrant特性——基于docker开发环境(docker和vagrant的结合)-4-简单例子-有问题

时间:2024-12-22 17:03:49

运行一个十分简单的例子:

Vagrant.configure() 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- user$ vagrant up
Bringing machine 'default' up with 'docker' provider...
==> default: Fixed port collision for => . Now on port .
==> default: Creating the container...
default: Name: test-1_default_1545915326
default: Image: hello-world
default: Volume: /Users/user/test-:/vagrant
default: Port: 127.0.0.1::
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.

然后容器也没有运行起来,这是为什么呢,有知道原因的小伙伴希望能够告知,还运行了一些其他的例子,感觉都没有真正的运行起来