vagrant:boot2docker:无法在本地查找图像“drupal”

我尝试在Vagrant box boot2docker(在Windows 8.1)上运行Drupal作为Docker容器。

Vagrantfile (Drupal容器)

# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.provider "docker" do |docker| docker.vagrant_vagrantfile = "host/Vagrantfile" docker.image = "drupal" docker.ports = ['80:80'] docker.name = 'drupal-container' end config.vm.synced_folder ".", "/vagrant", type: "smb", disabled: true end 

主机/ Vagrantfile (boot2docker)

 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "mitchellh/boot2docker" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.provision "docker" config.vm.hostname = "docker-host" end 

在我的Drupal容器的目录中运行vagrant up导致错误,因为找不到“drupal”图像。

产量

 Bringing machine 'default' up with 'docker' provider... ==> default: Docker host is required. One will be created if necessary... default: Vagrant will now create or start a local VM to act as the Docker default: host. You'll see the output of the `vagrant up` for this VM below. default: default: Importing base box 'mitchellh/boot2docker'... default: Matching MAC address for NAT networking... default: Checking if box 'mitchellh/boot2docker' is up to date... default: Setting the name of the VM: boot2docker_default_1463038875167_93224 default: Clearing any previously set network interfaces... default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Forwarding ports... default: 2375 (guest) => 2375 (host) (adapter 1) default: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) default: Running 'pre-boot' VM customizations... default: Booting VM... default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: docker default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... default: Machine booted and ready! No installation found. The guest's platform ("tinycore") is currently not supported, will try generic Linux method... Copy iso file C:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso Installing Virtualbox Guest Additions 5.0.20 - guest version is unknown mkdir: can't create directory '/tmp/selfgz80627365': No such file or directory Cannot create target directory /tmp/selfgz80627365 You should try option --target OtherDirectory An error occurred during installation of VirtualBox Guest Additions 5.0.20. Some functionality may not work as intended. In most cases it is OK that the "Window System drivers" installation failed. default: Checking for guest additions in VM... default: No guest additions were detected on the base box for this VM! Guest default: additions are required for forwarded ports, shared folders, host only default: networking, and more. If SSH fails on this machine, please install default: the guest additions and repackage the box to continue. default: default: This is not an error message; everything may continue to work properly, default: in which case you may ignore this message. default: Setting hostname... default: Running provisioner: docker... ==> default: Warning: When using a remote Docker host, forwarded ports will NOT be ==> default: immediately available on your machine. They will still be forwarded on ==> default: the remote machine, however, so if you have a way to access the remote ==> default: machine, then you should be able to access those ports there. This is ==> default: not an error, it is only an informational message. ==> default: Creating the container... default: Name: drupal-container default: Image: drupal default: Port: 80:80 A Docker command executed by Vagrant didn't complete successfully! The command run along with the output from the command is shown below. Command: "docker" "run" "--name" "drupal-container" "-d" "-p" "80:80" "drupal" Stderr: Unable to find image 'drupal' locally Pulling repository drupal 2016/05/12 07:42:05 Could not reach any registry endpoint Stdout: 

它工作,如果我把主机的箱子更改为ubuntu/trusty64

主机/ Vagrantfile (ubuntu / trusty64)

 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/trusty64" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.provision "docker" config.vm.hostname = "docker-host" end 

但我喜欢使用boot2docker,因为它更轻量级。

我的stream浪configuration有什么问题? 我怎样才能得到boot2docker框作为主机?

我实际上不能让你的configuration工作,但我已经testing了mitchellh/boot2docker框,发现问题。 该框中的docker version的输出是:

 Client version: 1.2.0 Client API version: 1.14 Go version (client): go1.3.1 Git commit (client): fa7b24f OS/Arch (client): linux/amd64 Server version: 1.2.0 Server API version: 1.14 Go version (server): go1.3.1 Git commit (server): fa7b24f 

这个版本的docker是非常过时的,现在无法从docker集线器拉图像。 您可以在这里看到docker工作组宣布弃用的位置: https : //blog.docker.com/2015/10/docker-hub-deprecation-1-5/

目前,您必须有docker> = 1.6才能从Docker集线器中提取图像。