我正在关注
vagrant guide to using docker,但是在启动vagrant时我收到此错误:
Jons-MacBook-Pro:vagrant jonhaven$vagrant up --provider=docker
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
default: Docker host VM is already ready.
==> default: Vagrant has noticed that the synced folder definitions have changed.
==> default: With Docker, these synced folder changes won't take effect until you
==> default: destroy the container and recreate it.
==> default: Starting container...
==> default: Waiting for container to enter "running" state...
The container started either never left the "stopped" state or
very quickly reverted to the "stopped" state. This is usually
because the container didn't execute a command that kept it running,
and usually indicates a misconfiguration.
If you meant for this container to not remain running, please
set the Docker provider configuration "remains_running" to "false":
config.vm.provider "docker" do |d|
d.remains_running = false
end
这是我的Dockerfile(与视频中相同):
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |d|
d.image = "paintedfox/postgresql"
end
end
谁看过这个吗?我正在使用OSX 10.9.4并使用Vagrant工作,否则就不使用Docker.
编辑:
我按照给出的建议并验证我可以通过docker运行我的docker图像.我的工作docker命令是这样的:
docker run -p 8888:8888 -d haven / play / opt / activator / activator ui -Dhttp.address = 0.0.0.0
但是,无论我在Vagrant中使用什么组合的create_args或cmd选项,我都无法通过vagrant启动它.要清楚,问题不是端口,而是docker容器不会保持运行.
最佳答案 如果没有保持标准的东西,Docker将停止.
貌似paintfox / postgresql CMD是[“/ sbin / my_init”]
我假设这是一个非守护进程的命令,意味着保持容器运行,这意味着它将被错误退出.我会尝试通过手动运行docker来调试:
docker run -i -t paintedfox/postgresql /bin/bash
然后尝试运行该命令:
/sbin/my_init
并查看它是否以错误退出.如果你在流浪汉中运行docker,你首先必须通过SSH连接到Vagrant
vagrant ssh