今天我尝试在朋友的机器上设置 ddev:
OS Windows 10 Home Docker Toolbox - 全新安装 Docker Toolbox Quickstart -> 指出我们需要启用虚拟化
BIOS -> 虚拟化 -> isEnabled Docker Toolbox Quickstart 运行。
适用于 Windows 10 全新安装的 ddev 配置的 druds ddev 有效。
snowm@ThomasWin10HP MINGW64 /c/Data3/test $ ddev start 开始测试...正在创建 ddev-test-db ...错误
错误:ddev-test-db 无法为服务 db 创建容器:类型“bind”的挂载配置无效:绑定挂载源路径不存在:/c/Data3/test/.ddev
错误:for db 无法为服务 db 创建容器:类型“bind”的挂载配置无效:绑定挂载源路径不存在:/c/Data3/test/.ddev 在启动项目时遇到错误。创建 ddev-test-db ... 错误
错误:ddev-test-db 无法为服务 db 创建容器:类型“bind”的挂载配置无效:绑定挂载源路径不存在:/c/Data3/test/.ddev
错误:for db 无法为服务 db 创建容器:类型“bind”的挂载配置无效:绑定挂载源路径不存在:/c/Data3/test/.ddev 在启动项目时遇到错误。
但为了确保路径存在。:-(
我们阅读了这个(与 docker 共享驱动器),但它看起来 docker 工具箱项目没有这个 GUI: “bind”类型的安装配置无效:尝试在 Docker for Windows 上运行容器时,绑定源路径不存在
config.yaml 看起来像这样:
APIVersion: v1.2.0
Name: test
type: typo3
docroot: www
php_version: "7.2"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
provider: default
docker-compose.yaml 看起来像这样
version: '3.6'
#ddev-generated
services:
db:
container_name: ddev-${DDEV_SITENAME}-db
image: $DDEV_DBIMAGE
stop_grace_period: 60s
volumes:
- type: "volume"
source: mariadb-database
target: "/var/lib/mysql"
volume:
nocopy: true
- type: "bind"
source: "${DDEV_IMPORTDIR}"
target: "/db"
- type: "bind"
source: "."
target: "/mnt/ddev_config"
restart: "no"
user: "$DDEV_UID:$DDEV_GID"
ports:
- "3306"
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.platform: ddev
com.ddev.app-type: typo3
com.ddev.approot: $DDEV_APPROOT
com.ddev.app-url: $DDEV_URL
environment:
- COLUMNS=$COLUMNS
- LINES=$LINES
command: "$DDEV_MARIADB_LOCAL_COMMAND"
web:
container_name: ddev-${DDEV_SITENAME}-web
image: $DDEV_WEBIMAGE
volumes:
- "../:/var/www/html:cached"
- ".:/mnt/ddev_config:ro"
restart: "no"
user: "$DDEV_UID:$DDEV_GID"
depends_on:
- db
links:
- db:db
# ports is list of exposed *container* ports
ports:
- "80"
- "8025"
working_dir: /var/www/html/${DDEV_DOCROOT}
environment:
- DDEV_URL=$DDEV_URL
- DOCROOT=$DDEV_DOCROOT
- DDEV_PHP_VERSION=$DDEV_PHP_VERSION
- DDEV_WEBSERVER_TYPE=$DDEV_WEBSERVER_TYPE
- DDEV_PROJECT_TYPE=$DDEV_PROJECT_TYPE
- DDEV_ROUTER_HTTP_PORT=$DDEV_ROUTER_HTTP_PORT
- DDEV_ROUTER_HTTPS_PORT=$DDEV_ROUTER_HTTPS_PORT
- DDEV_XDEBUG_ENABLED=$DDEV_XDEBUG_ENABLED
- DEPLOY_NAME=local
- VIRTUAL_HOST=$DDEV_HOSTNAME
- COLUMNS=$COLUMNS
- LINES=$LINES
# HTTP_EXPOSE allows for ports accepting HTTP traffic to be accessible from <site>.ddev.local:<port>
# To expose a container port to a different host port, define the port as hostPort:containerPort
- HTTP_EXPOSE=${DDEV_ROUTER_HTTP_PORT}:80,8025
# You can optionally expose an HTTPS port option for any ports defined in HTTP_EXPOSE.
# To expose an HTTPS port, define the port as securePort:containerPort.
- HTTPS_EXPOSE=${DDEV_ROUTER_HTTPS_PORT}:80
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.platform: ddev
com.ddev.app-type: typo3
com.ddev.approot: $DDEV_APPROOT
com.ddev.app-url: $DDEV_URL
extra_hosts: ["unneeded:127.0.0.1"]
dba:
container_name: ddev-${DDEV_SITENAME}-dba
image: $DDEV_DBAIMAGE
restart: "no"
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.platform: ddev
com.ddev.app-type: typo3
com.ddev.approot: $DDEV_APPROOT
com.ddev.app-url: $DDEV_URL
depends_on:
- db
links:
- db:db
ports:
- "80"
environment:
- PMA_USER=db
- PMA_PASSWORD=db
- VIRTUAL_HOST=$DDEV_HOSTNAME
# HTTP_EXPOSE allows for ports accepting HTTP traffic to be accessible from <site>.ddev.local:<port>
- HTTP_EXPOSE=8036
networks:
default:
external:
name: ddev_default
volumes:
mariadb-database:
name: "${DDEV_SITENAME}-mariadb"
解决方案:
我们删除了所有内容(~/.ddev ~/.docker 等),卸载了 docker 工具箱、ddev 和虚拟机,这一次完全按照“逐步”进行操作:
- 首先在 BIOS 设置中启用虚拟化
- 然后将 docker Toolbox 安装为 ADMIN 并让 Docker Toolbox 也安装带有 ndis 网络驱动程序的 virtualbox(最后一个复选框)
- 等待,同时什么也不做,以确保看到 ACL - 问题
- 以管理员身份启动 virtualbox(现在网络适配器已创建)
- RESTART Windows 一切都已正确启动
- 安装 ddev als 管理员,让他创建快捷方式并将自己添加到 windows 路径
- 启动 docker quickstart 终端,让 docker Toolbox 创建一个默认的虚拟容器
切换到用户主目录
cd ~ mkdir web cd web mkdir testdomain cd testdomain ddev start
感谢 fray,正如他的暗示,ddev 项目必须在用户主目录下是它不起作用的主要原因。
也许上面的一个或多个步骤并不重要,但由于它现在正在运行,我将保持原样:-)