gpt4 book ai didi

drupal - Vagrant:boot2docker:无法在本地找到图像 'drupal'

转载 作者:行者123 更新时间:2023-12-02 19:11:15 25 4
gpt4 key购买 nike

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

Vagrant 文件 (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

主机/Vagrant 文件 (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

运行 vagrant up在我的 Drupal 容器目录中导致错误,因为找不到“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,它可以工作

主机/Vagrant 文件 (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,因为它更轻量。

我的 vagrant 配置有什么问题?我怎样才能让 boot2docker 盒子作为主机工作?

最佳答案

我实际上无法让您的配置正常工作,但我已经测试了 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 hub 拉取图像。您可以在此处查看 docker 团队宣布弃用的位置: https://blog.docker.com/2015/10/docker-hub-deprecation-1-5/

目前,您必须拥有 docker >= 1.6 才能从 docker hub 拉取图像。

关于drupal - Vagrant:boot2docker:无法在本地找到图像 'drupal',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37180608/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com