繁体   English   中英

无法在 docker 容器中运行 mariadb

[英]Unable to run mariadb in a docker container

我对使用 Docker 还不是很熟悉。 我在 Debian 服务器上使用 Docker。 我尝试在 Docker 容器上运行 MariaDB ,到目前为止有效。 然而,最近我总是得到一个错误。
这是我的 docker-compose 文件:

version: '3.9'
services:
  repository:
    container_name: repository
    image: sonatype/nexus3
    restart: always
    networks:
      main:
    ports:
      - "8081:8081"
  mariadb:
    container_name: mariadb
    image: mariadb
    restart: always
    ports:
      - "3306:3306"
    healthcheck:
      test: "/usr/bin/mysql --user=root --password=root_password --execute \"SHOW DATABASES;\""
      interval: 2s
      timeout: 30s
      retries: 15
    networks:
      main:
    environment:
      MARIADB_ROOT_PASSWORD: root_password
      MARIADB_AUTO_UPGRADE: "yes"
      MARIADB_USER: user
      MARIADB_DATABASE: database
      MARIADB_PASSWORD: password
    volumes:
      - "mariadb-data:/var/lib/mysql"
networks:
  main:
volumes:
  mariadb-data:

当我查看容器的日志时,会出现以下内容:

2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.3+maria~focal started.
2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.7.3+maria~focal started.
2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: MariaDB upgrade information missing, assuming required
2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: Starting temporary server
2022-04-24 13:47:54+00:00 [Note] [Entrypoint]: Waiting for server startup
2022-04-24 13:47:54 0 [Note] mariadbd (server 10.7.3-MariaDB-1:10.7.3+maria~focal) starting as process 49 ...
2022-04-24 13:47:54 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-04-24 13:47:54 0 [Note] InnoDB: Number of transaction pools: 1
2022-04-24 13:47:54 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-04-24 13:47:54 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-04-24 13:47:54 0 [Note] InnoDB: Using Linux native AIO
2022-04-24 13:47:54 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-04-24 13:47:54 0 [Note] InnoDB: Completed initialization of buffer pool
2022-04-24 13:47:54 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=3821844,3821844
2022-04-24 13:47:54 0 [ERROR] InnoDB: Missing FILE_CHECKPOINT at 3821844 between the checkpoint 3821844 and the end 3821868.
2022-04-24 13:47:54 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-04-24 13:47:54 0 [Note] InnoDB: Starting shutdown...
2022-04-24 13:47:55 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-04-24 13:47:55 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-04-24 13:47:55 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-04-24 13:47:55 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2022-04-24 13:47:55 0 [ERROR] Aborting

此错误的原因是什么,我该如何解决?

如果您不需要数据库数据,请尝试删除“mariadb-data”卷。 您是否更改了容器的版本?

我遇到了由以前的 mysql 安装引起的类似问题。

我删除了我的卷引用的文件夹(在你的情况下是 mariadb-data),我停止并删除了所有容器:

docker stop $ (docker ps -a -q)
docker rm $ (docker ps -a -q)

在该命令中,docker ps -a -q 用于显示所有 Docker 容器的 ID 列表,并使用 docker rm 删除它们。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM