简体   繁体   English

docker-compose up invalid mode /docker-entrypoint-initdb.d/ - 无法为服务数据库创建容器

[英]docker-compose up invalid mode /docker-entrypoint-initdb.d/ - cannot create container for service database

I have to use docker-compose up to start a database.我必须使用 docker-compose up 来启动数据库。 Everything we needed for that is already given and it works for my partners.我们为此所需的一切都已经提供,并且对我的合作伙伴有用。 Meanwhile I have the following problem.同时我有以下问题。 (I'm using Mac OS Catalina btw) Every time I try to use docker-compose up the following error occurs (我正在使用 Mac OS Catalina 顺便说一句)每次我尝试使用 docker-compose up 时都会发生以下错误

docker-compose up码头工人组成

Creating ziegel24_database_1... error创建 ziegel24_database_1...错误

ERROR: for ziegel24_database_1 Cannot create container for service database: invalid mode: /docker-entrypoint-initdb.d/错误:对于 ziegel24_database_1 无法为服务数据库创建容器:无效模式:/docker-entrypoint-initdb.d/

ERROR: for database Cannot create container for service database: invalid mode: /docker-entrypoint-initdb.d/ ERROR: Encountered errors while bringing up the project.错误:对于数据库无法为服务数据库创建容器:无效模式:/docker-entrypoint-initdb.d/ 错误:启动项目时遇到错误。

the docker-compose.yml is the following docker-compose.yml 如下

version: "3.1"
services:
  database:
    image: mysql:5.7
    volumes:
      - ./mysql/db/entrypoint:/docker-entrypoint-initdb.d/
    ports:
      - "3308:3306"
    environment:
      - "MYSQL_ROOT_PASSWORD=geheim"
      - "MYSQL_DATABASE=Ziegel24"

I have already checked if my docker compose and engine are the correct version which they are.我已经检查过我的 docker compose 和 engine 是否是正确的版本。 (Mysql is on a newer version but since docker creates a new database it would pull the needed sql version I was told) (Mysql 是一个较新的版本,但由于 docker 创建了一个新的数据库,它会拉取所需的 sql 版本,我被告知)

I also have tried to locate the said docker-entrypoint-initdb.d directory but even running find on my whole computer didn't give results, so I guess the whole directory is not there?我也试图找到所说的 docker-entrypoint-initdb.d目录,但即使在我的整个计算机上运行 find 也没有给出结果,所以我猜整个目录不在那里?

Is there any way to download it manually or does it come in a package I mistakenly didn't install?有没有办法手动下载它,或者它是否包含在我错误地没有安装的包中?

EDIT I've realised the docker-entrypoint-initdb.d shouldn't be on my computer anyway, but in the mysql:5.7 image.编辑我已经意识到 docker-entrypoint-initdb.d 无论如何都不应该在我的电脑上,而是在 mysql:5.7 图像中。 I still don't know what the exact error is and how to fix it but yeah that's new.我仍然不知道确切的错误是什么以及如何修复它,但是是的,这是新的。

Since I didn't find any help when I searched my error I came here for help.由于我在搜索错误时没有找到任何帮助,所以我来这里寻求帮助。

The short syntax for volumes is (HOST:CONTAINER) or (HOST:CONTAINER:ro) if access mode is specified.如果指定了访问模式,卷的简短语法(HOST:CONTAINER)(HOST:CONTAINER:ro) If the host path contains a colon ( : ) CONTAINER is interpreted as access mode.如果主机路径包含冒号 ( : ,则CONTAINER被解释为访问模式。

In your case ./mysql/db/entrypoint is a relative path and docker expands it to full path.在您的情况下./mysql/db/entrypoint是相对路径,docker 将其扩展为完整路径。 If this full path contains a colon, /docker-entrypoint-initdb.d/ is considered the access mode which is obviously invalid (allowed values are ro and rw ), hence the error.如果此完整路径包含冒号, /docker-entrypoint-initdb.d/被视为显然无效的访问模式(允许的值为rorw ),因此会出现错误。

This might not be your case but I could reproduce the behaviour above with Docker version 18.04.0-ce, build 3d479c0 and docker-compose version 1.21.0, build 5920eb0 on Ubuntu 14.04.5 LTS.这可能不是你的情况,但我可以在 Ubuntu 14.04.5 LTS 上使用 Docker 版本 18.04.0-ce、build 3d479c0 和 docker-compose 版本 1.21.0、build 5920eb0 重现上述行为。

Hope this helps.希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 mysql docker 容器在 docker-entrypoint-initdb.d 中创建数据库 - Can't create db in docker-entrypoint-initdb.d with mysql docker container sql转储是否被加密到docker容器docker-entrypoint-initdb.d中? - Are sql dumps moved into docker container `docker-entrypoint-initdb.d` encrypted? 当容器从另一个容器中启动时,docker-entrypoint-initdb.d 为空 - docker-entrypoint-initdb.d is empty when container is started from within another container 为什么我的 docker-entrypoint-initdb.d 脚本(在 docker-compose.yml 中指定)没有被执行来初始化一个新的 MySQL 实例? - Why isn't my docker-entrypoint-initdb.d script (as specified in docker-compose.yml) executed to initialize a fresh MySQL instance? docker 权限被拒绝 mysql 映像中的 shell 脚本放置在 docker-entrypoint-initdb.d - docker permission denied for shell script in mysql image placed at docker-entrypoint-initdb.d 使用docker-compose,数据库容器无法启动并运行 - With docker-compose, database container is not up and running 自定义mysql高山映像未从作为卷安装的docker-entrypoint-initdb.d加载init.sql - Custom mysql alpine image not loading init.sql from docker-entrypoint-initdb.d mounted as a volume 如何等待docker-entrypoint-initdb.d在Shell脚本/ Bash中加载数据库? - How to wait for docker-entrypoint-initdb.d to load DB in Shell Script/Bash? 命令&#39;/ bin / sh -c mysql -u wordpress -pwordpress wordpress &lt;/docker-entrypoint-initdb.d/wordpress.sql&#39;返回非零代码:1 - The command '/bin/sh -c mysql -u wordpress -pwordpress wordpress < /docker-entrypoint-initdb.d/wordpress.sql' returned a non-zero code: 1 docker-compose 无法等待 mysql 数据库 - docker-compose cannot wait for mysql database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM