2

I'm currently setting up a docker container group for development purposes using docker-compose.

I have a web container, a mysql container, and a phpmyadmin container. I'm using https://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/php-apache-dev.html as web container, the mariadb:10 image for the mysql container, and phpmyadmin/phpmyadmin:latest as phpmyadmin image.

The docker-compose.yml file looks like this:

version: '3'
services:
    web:
        container_name: web
        restart: always
        image: webdevops/php-apache-dev:7.4
        user: application
        environment:
            - COMPOSER_VERSION=1
            - WEB_ALIAS_DOMAIN=localhost
            - WEB_DOCUMENT_ROOT=/app/pub
            - PHP_DATE_TIMEZONE=EST
            - PHP_DISPLAY_ERRORS=1
            - PHP_MEMORY_LIMIT=2048M
            - PHP_MAX_EXECUTION_TIME=300
            - PHP_POST_MAX_SIZE=500M
            - PHP_UPLOAD_MAX_FILESIZE=1024M
        volumes:
            - /projects/project-x:/app:cached
        ports:
            - '80:80'
            - '443:443'
            - '32823:22'
        links:
            - mysql
    mysql:
        container_name: mysql
        restart: always
        image: mariadb:10
        ports:
            - '3306:3306'
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_DATABASE=magento
        volumes:
            - db-data:/var/lib/mysql
    phpmyadmin:
        container_name: phpmyadmin
        restart: always
        image: phpmyadmin/phpmyadmin:latest
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - PMA_USER=root
            - PMA_PASSWORD=root
        ports:
            - '8080:80'
        links:
            - mysql:db
        depends_on:
            - mysql
volumes:
    db-data:
        external: false

This works fine. However, my development project requires mariadb with version 10.2-10.4, nothing above. The standard mariadb:10 image currently provides 10.5.

When I change the line image: mariadb:10 to image: mariadb:10.4, the container keeps restarting when I run docker-compose up -d --build.

I checked on https://hub.docker.com/_/mariadb for pointers, but couldn't find a difference in setting up a container using 10.5 or 10.4 or 10.2 for that matter.

Any ideas?

Edits

I followed @xdhmoore's suggestion and changed restart to 'no'. This is the log I am getting from the container:

2021-02-22 20:34:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.17+maria~focal started.

2021-02-22 20:34:57+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2021-02-22 20:34:57+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.17+maria~focal started.

2021-02-22 20:34:57 0 [Note] mysqld (mysqld 10.4.17-MariaDB-1:10.4.17+maria~focal) starting as process 1 ...

2021-02-22 20:34:57 0 [Note] InnoDB: Using Linux native AIO

2021-02-22 20:34:57 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2021-02-22 20:34:57 0 [Note] InnoDB: Uses event mutexes

2021-02-22 20:34:57 0 [Note] InnoDB: Compressed tables use zlib 1.2.11

2021-02-22 20:34:57 0 [Note] InnoDB: Number of pools: 1

2021-02-22 20:34:57 0 [Note] InnoDB: Using SSE2 crc32 instructions

2021-02-22 20:34:57 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)

2021-02-22 20:34:57 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M

2021-02-22 20:34:57 0 [Note] InnoDB: Completed initialization of buffer pool

2021-02-22 20:34:57 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

2021-02-22 20:34:57 0 [ERROR] InnoDB: Unsupported redo log format. The redo log was created with MariaDB 10.5.8.

2021-02-22 20:34:57 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error

2021-02-22 20:34:57 0 [Note] InnoDB: Starting shutdown...

2021-02-22 20:34:58 0 [ERROR] Plugin 'InnoDB' init function returned error.

2021-02-22 20:34:58 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2021-02-22 20:34:58 0 [Note] Plugin 'FEEDBACK' is disabled.

2021-02-22 20:34:58 0 [ERROR] Unknown/unsupported storage engine: InnoDB

2021-02-22 20:34:58 0 [ERROR] Aborting

I then googled for the first error that occurs and found this: MYSQL 8.0 - unsupported redo log format

It seems like I'd need to delete /var/lib/mysql/ to solve my issue. However, this is inside a docker container that I'm not able to start. Also, I rebuild this container upon every start, so I don't know how I can purge this directory?

  • 2
    Oh: *However, this is inside a docker container that I'm not able to start.* => well, no it is not. `- db-data:/var/lib/mysql` this is a volume. Remove it and you are good. – β.εηοιτ.βε Feb 22 '21 at 20:49
  • 1
    You are right, thank you for your help. I ran `docker volume ls` and then `docker volume rm ` and that worked. The issue indeed was that the logs folder was initially created using a later version of mariadb. – codingforworlddomination Feb 22 '21 at 20:51
  • 1
    Huzzah! Teamwork. – xdhmoore Feb 22 '21 at 20:52

1 Answers1

1

It sounds like it's failing to start up and then docker-compose is continually restarting it, making it impossible to read any startup logs. You can tell docker-compose not to do this this by changing your mysql restart to no according to the docks here. That should give you a chance to do a partial startup and read about what the actual failure is in the logs.

xdhmoore
  • 8,935
  • 11
  • 47
  • 90
  • 1
    Hey @xdhmoore I followed your suggestion and posted the outcome in an edit to my initial post. I might have found a solution, but don't know how to apply it in docker --> how to delete a directory of log files inside a container that only exists when I run it, but that doesn't allow me to enter because it doesn't start correctly? – codingforworlddomination Feb 22 '21 at 20:43
  • 3
    @codingforworlddomination your volume is `db-data`. So what you could do is to attach any simple container to it (like a basic debian or ubuntu), clean the said folder and see what happens from there – β.εηοιτ.βε Feb 22 '21 at 20:46
  • 2
    Indeed, this worked: I ran `docker volume ls` and then `docker volume rm ` and started up again. The issue indeed was that the logs folder was initially created using a later version of mariadb. Thanks a lot for your help! – codingforworlddomination Feb 22 '21 at 20:50