通过Vagrantfile安装Docker

时间:2018-09-25 13:03:09

标签: docker vagrantfile

据此:

https://www.vagrantup.com/docs/provisioning/docker.html

  

Vagrant Docker供应商可以自动安装Docker,提取Docker容器并配置某些容器以在启动时运行。

但是我在此页面上没有看到有关此操作的任何说明。

我尝试了这个Vagrantfile:

Vagrant.configure('2') do |config|
    config.vm.box = "hashicorp/precise64"
    config.vm.define "vm1"
    config.vm.provision "docker" do |d|
      d.build_image "/vagrant/app"
    end
end

碰到

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

curl -sSL https://get.docker.com/ | sh

Stdout from the command:

# Executing docker install script, commit: 36b78b2


Stderr from the command:

+ sh -c echo "deb http://ftp.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list
+ sh -c apt-get update -qq >/dev/null
W: GPG error: http://ftp.debian.org wheezy-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
dpkg-preconfigure: unable to re-open stdin: No such file or directory

还有这个(来自https://www.vagrantup.com/docs/provisioning/docker.html):

Vagrant.configure("2") do |config|
  config.vm.provision "docker" do |d|
    d.build_image "/vagrant/app"
  end
end

遇到:

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* A box must be specified.

我想主要问题是:

  1. 为什么正式文档(https://www.vagrantup.com/docs/provisioning/docker.html)不起作用?

和 2.由于我猜测您需要指定一个盒子,为什么当我指定一个盒子时会得到这个?

W: GPG error: http://ftp.debian.org wheezy-backports Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
dpkg-preconfigure: unable to re-open stdin: No such file or directory

有什么建议吗?

0 个答案:

没有答案