21-09-2023

Docker failed to read from file ERROR

So when you use docker, you can meet with multiple errors.

Here is one of them:

InnoDB: Failed to read page 10815 from file './database/jobs.ibd': Page read from tablespace is corrupted.

No matter if you try the following:

docker-compose rm -s -f -v database
docker-compose up --force-recreate --no-deps database

The error is still there. But why?

The problem here is with the attached volume.
Attached where?

    database:
      image: mysql:latest
      environment:
        - MYSQL_DATABASE=${MYSQL_DATABASE}
        - MYSQL_USER=${MYSQL_USER}
        - MYSQL_PASSWORD=${MYSQL_PASSWORD}
        - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
        - TZ=${WORKSPACE_TIMEZONE}
      volumes:
        - ${DATA_PATH_HOST}/mysql:/var/lib/mysql <---- HERE you might have a problem
        - ${MYSQL_ENTRYPOINT_INITDB}:/docker-entrypoint-initdb.d
      ports:
        - "${MYSQL_PORT}:3306"
      restart: unless-stopped
      networks:
        - backend

The error says, your volume is corrupted (damaged) so that's why docker can't spin up your container.

You need to delete that folder in your host machine and now you are ready to use your database container.


© 2024 PappZ. All rights reserved.