2016-05-12 71 views
1

我嘗試在Vagrant box boot2docker(在Windows 8.1)上運行Drupal作爲Docker容器。Vagrant:boot2docker:無法在本地找到'drupal'圖像

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,因爲它更輕量。

我的流浪配置有什麼問題?我如何讓boot2docker框作爲主機工作?

回答

2

我實際上不能讓你的配置工作,但我已經測試了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 

泊塢窗的這個版本是非常過時,現在無法拉離泊塢窗樞紐圖像在所有。您可以在此處看到碼頭工作組宣佈棄用的位置:https://blog.docker.com/2015/10/docker-hub-deprecation-1-5/

當前,您必須有docker> = 1.6才能從Docker集線器中提取圖像。

+0

添加到此 - 在第二種情況下,你只是在你的Ubuntu VM上安裝docker而不是拉動任何圖像 –

+0

我認爲他們仍然使用帖子頂部的drupal Vagrantfile。雖然我無法讓雙盲流文件設置爲我工作。 – joelnb

+0

你不能同時使用docker提供者和配置 - 要麼在你定義的系統上使用docker provision(ubuntu/centos ...)來將docker安裝到這個虛擬機上並且拉出圖像等等...或者你使用碼頭服務提供商,這將推動碼頭在Boot2docker虛擬機上(不確定流浪者是否有計劃支持當前的碼頭服務器,現在它已經爲mac/windows發佈) –