0

我正在尝试将存储驱动程序更改为 mac 上的 devicemapper。并按照在 Mac OS X 上更改 docker 存储驱动程序中的步骤进行操作

但我收到以下错误,我的 docker for mac 是最新版本。

$ docker-machine create --driver virtualbox  --engine-storage-driver devicemapper test2
Running pre-create checks...
Creating machine...
(test2) Copying /Users/weiwang/.docker/machine/cache/boot2docker.iso to /Users/weiwang/.docker/machine/machines/test2/boot2docker.iso...
(test2) Creating VirtualBox VM...
(test2) Creating SSH key...
(test2) Starting the VM...
(test2) Check network to re-create if needed...
(test2) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Error creating machine: Error checking the host: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.105:2376": read tcp 192.168.99.1:49168->192.168.99.105:2376: read: connection reset by peer
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which will stop running containers.
4

1 回答 1

1

注意:请阅读更新

不再支持 Devicemapper。您可以使用也很好的叠加层。

用法: docker-machine create --driver virtualbox --engine-storage-driver overlay test2

编辑:

我最初的评论没有正确回答这个问题。在对 devicemapper 存储驱动程序的工作原理进行了更多研究之后,发现默认的boot2docker基础操作系统 docker-machine 不支持 devicemapper 存储驱动程序。

以下是支持的发行版列表:

  • RHEL/CentOS/Fedora
  • Ubuntu 12.04
  • Ubuntu 14.04
  • Debian

更详细的信息可以在这里找到。

因此,要解决此问题,您需要在 VM 中安装上述发行版之一。添加 SSH 服务器和无需 tty 即可运行命令的无密码 sudo 用户。

我通过在 VirtualBox 中安装 CentOS VM、添加 NAT 和仅主机驱动程序(用于下载 Internet 包的 NAT 以及用于 docker-machine 和 VM 可以通信的专用网络的仅主机适配器)来尝试这一点。 )

设置好 VM 后,您可以使用以下命令将其连接到 docker-machine。docker-machine 将 ssh 进入虚拟机并检查是否安装了 Docker 引擎。如果不是这种情况,它将自动下载和配置。

docker-machine create \
  --driver generic \
  --generic-ip-address=192.168.58.14 \
  --generic-ssh-port 22 \
  --generic-ssh-key ~/.ssh/id_rsa \
  --engine-storage-driver devicemapper \
  docker-centos

有关在此处使用通用驱动程序的更多信息: https ://docs.docker.com/machine/drivers/generic/

希望这比最初的答案对您有所帮助:)

于 2016-08-30T19:06:33.890 回答