无法在Docker容器中运行mariadb

weylhg0b  于 2022-11-08  发布在  Docker
关注(0)|答案(1)|浏览(147)

我还不太熟悉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

此错误的原因是什么?如何修复此错误?

lokaqttq

lokaqttq1#

我有一个类似的问题所造成的以前的mysql安装。
可以通过删除或重命名卷所引用的文件夹(mariadb-data),然后删除并重新启动当前容器/所有容器来解决此问题,以确保:

docker stop $ (docker ps -a -q)
docker rm $ (docker ps -a -q)
  • 在此命令中,docker ps -a -q用于显示所有Docker容器的ID列表,而docker rm用于删除它们。*

现在,容器应正常启动。

相关问题