【发布时间】:2021-08-29 08:23:21
【问题描述】:
- 我一直在尝试使用来自 docker hub 的 official image 安装 drupal。我在 D 目录中为我的 Drupal 项目创建了一个新文件夹,并创建了一个 docker-compose.yml 文件。
Drupal with PostgreSQL
Access via "http://localhost:8080"
(or "http://$(docker-machine ip):8080" if using docker-machine)
During initial Drupal setup,
Database type: PostgreSQL
Database name: postgres
Database username: postgres
Database password: example
ADVANCED OPTIONS; Database host: postgres
version: '3.1' services:
drupal:
image: drupal:8-apache ports:
- 8080:80
volumes:
- /var/www/html/modules
- /var/www/html/profiles
- /var/www/html/themes
this takes advantage of the feature in Docker that a new anonymous
volume (which is what we're creating here) will be initialized with the
existing content of the image at the same location
- /var/www/html/sites
restart: always
postgres:
image: postgres:10
environment:
POSTGRES_PASSWORD: example
restart: always
当我从包含 docker-compose.yml 文件的文件夹中的终端中运行 docker-compose up -d 命令时,我的 drupal 容器及其数据库已成功安装并运行,并且我能够访问该站点来自 http://localhost:8080 但我在文件夹中找不到他们的核心文件。它只是文件夹中的 docker-compose.yml 文件。
- 然后我删除了整个 docker 容器并再次开始全新安装,方法是编辑 docker-compose.yml 文件中的卷部分以指向我希望填充 drupal 核心文件的目录和文件夹。 示例 D:/我的项目/Drupal 项目。
Drupal with PostgreSQL
Access via "http://localhost:8080"
(or "http://$(docker-machine ip):8080" if using docker-machine)
During initial Drupal setup,
Database type: PostgreSQL
Database name: postgres
Database username: postgres
Database password: example
ADVANCED OPTIONS; Database host: postgres
version: '3.1'
services:
drupal:
image: drupal:latest
ports:
- 8080:80
volumes:
- d:\projects\drupalsite/var/www/html/modules
- d:\projects\drupalsite/var/www/html/profiles
- d:\projects\drupal/var/www/html/themes
this takes advantage of the feature in Docker that a new anonymous
volume (which is what we're creating here) will be initialized with the
existing content of the image at the same location
- d:\projects\drupalsite/var/www/html/sites
restart: always
postgres:
image: postgres:10
environment:
POSTGRES_PASSWORD: example
restart: always
当我运行 docker-compose.yml 命令时,我收到如下所示的错误。
Container drupalsite_postgres_1 Created 3.2s
- Container drupalsite_drupal_1 Creating 3.2s
Error response from daemon: invalid mount config for type "volume": invalid mount path: 'z:/projects/drupalsite/var/www/html/sites' mount path must be absolute
PS Z:\Projects\drupalsite>
请帮我找到解决办法。
【问题讨论】:
标签: docker docker-volume