我的目标是从Docker容器运行一个烧瓶网络服务器。在Windows机器上工作需要Vagrant来创建VM。运行vagrant up --provider = docker导致以下投诉:
INFO interface: error: 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
FROM mrmrcoleman/python_webapp
EXPOSE 5000
# Install Python
RUN apt-get install -y python python-dev python-distribute python-pip
# Add and install Python modules
RUN pip install Flask
#copy the working directory to the container
ADD . /
CMD python run.py
这是Vagrantfile
Vagrant.configure("2") do |config|
config.vm.provider "docker" do |d|
d.build_dir = "." #searches for a local dockerfile
end
config.vm.synced_folder ".", "/vagrant", type: "rsync"
rsync__chown = false
end
因为Vagrantfile和run.py独立工作没有问题,我怀疑我在Dockerfile中犯了一个错误。我的问题有两个:
答案 0 :(得分:2)
我认为我正在寻找的答案是使用命令
vagrant docker-logs
我打破了Dockerfile,因为我没有认识到良好的行为,因为如果应用程序运行应该没有真正发生的事情。 docker-logs确认烧瓶应用正在监听请求。