?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
注意:請注意,這是一個社區(qū)貢獻的安裝路徑。
要使用本指南,您需要 Chef 的工作安裝。這本烹飪書支持各種操作系統(tǒng)。
Cookbook可在 Chef Supermarket 實現(xiàn),并可使用您最喜歡的食譜依賴管理器進行安裝。
源可以在GitHub上找到。
添加depends 'docker', '~> 2.0'
到你的食譜的 metadata.rb
使用菜譜中的資源,就像使用核心廚師資源(文件,模板,目錄,包等)一樣。
docker_service 'default' do action [:create, :start]end docker_image 'busybox' do action :pull end docker_container 'an echo server' do repo 'busybox' port '1234:1234' command "nc -ll -p 1234 -e /bin/cat"end
以下是拉取最新映像并運行帶有暴露端口的容器的簡單示例。
# Pull latest image docker_image 'nginx' do tag 'latest' action :pull end # Run container exposing ports docker_container 'my_nginx' do repo 'nginx' tag 'latest' port '80:80' binds [ '/some/local/files/:/etc/nginx/conf.d' ] host_name 'www' domain_name 'computers.biz' env 'FOO=bar' subscribes :redeploy, 'docker_image[nginx]'end