많은 구름에서 방랑을 성공적으로 사용했습니다.docker 공급자가있는 방랑제에서 provision.sh를 실행하는 방법
나는 도커로 무언가를 시도하기로 결심했다. 그러나 나는 대단히 실패한 것처럼 매우 기본적인 것을 놓친다. (I 물론 그것을 특정 클라우드 세부 사항을 추가하는 경우)이 구성이 다른 구름 위해 나를 위해 일한
Vagrant.configure("2") do |config|
config.vm.synced_folder "../synced_folder", "/vagrant"
config.vm.provision "shell" do |s|
s.path = "provision.sh"
s.privileged = false
end
config.vm.provider :docker do |docker, override|
docker.image = 'ubuntu'
end
end
:
나는이 방랑 파일을 썼다.내 provision.sh
파일이 단순히 echo "hello world"
내 synced_folder이 더미 파일이 있습니다 .. 내가 ubuntu
이미지가 고정 표시기에서 잘 작동하는지 확인한
있습니다. 도커가 잘 작동하는 것 같습니다. 내가 vagrant up --provider docker
을 실행하면
나는 다음과 같은
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
내가 hello world
인쇄를 볼 수 없습니다 얻을.
이 오류와 관련하여 많은 Q & A가 발견되었지만 문제를 해결하는 데 사용할 수있는 방법이 없습니다.
내가 뭘 잘못하고 있니?
이 명령을 실행하더라도 제공 스크립트를 실행하려고합니다. 이 대답은 SSH를 설정하는 것 같습니다. –
provision.sh에 간단한 것들이 있다면 Dockerfile에 넣을 수 있고, 당신이 유황을 다룰 때 실행될 것입니다. 다른 옵션 : SSH의 경우 우분투 기본 이미지 [link] (https://docs.docker.com/examples/running_ssh_service/)에 ssh 서비스를 추가하거나 phusion과 같은 기존 ssh 지원 기본 이미지를 가져올 수 있습니다 [link] (https://github.com/phusion/baseimage-docker) –