I have the following docker-compose.yaml file:
version: '3.8'
services:
db:
image: mysql:5.7
container_name: flutter-academy-mysql
environment:
MYSQL_ROOT_PASSWORD: HeiL0ier
MYSQL_DATABASE: course
volumes:
- ~/dockerdata/flutter-academy:/var/lib/mysql
ports:
- 3306:3306
When I run the command docker-compose up I get the following output:
Creating network "advanced_default" with the default driver
Creating flutter-academy-mysql ... done
Attaching to flutter-academy-mysql
flutter-academy-mysql | 2021-03-28 21:33:07+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
flutter-academy-mysql | 2021-03-28 21:33:07+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
flutter-academy-mysql | 2021-03-28 21:33:08+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
flutter-academy-mysql | 2021-03-28T21:33:08.150797Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
flutter-academy-mysql | 2021-03-28T21:33:08.150947Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
flutter-academy-mysql | 2021-03-28T21:33:08.365890Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
flutter-academy-mysql | 2021-03-28T21:33:08.367953Z 0 [Note] mysqld (mysqld 5.7.33) starting as process 1 ...
flutter-academy-mysql | 2021-03-28T21:33:08.376454Z 0 [Note] InnoDB: PUNCH HOLE support available
flutter-academy-mysql | 2021-03-28T21:33:08.376507Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
flutter-academy-mysql | 2021-03-28T21:33:08.376520Z 0 [Note] InnoDB: Uses event mutexes
flutter-academy-mysql | 2021-03-28T21:33:08.376532Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
flutter-academy-mysql | 2021-03-28T21:33:08.376541Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
flutter-academy-mysql | 2021-03-28T21:33:08.376549Z 0 [Note] InnoDB: Using Linux native AIO
flutter-academy-mysql | 2021-03-28T21:33:08.377078Z 0 [Note] InnoDB: Number of pools: 1
flutter-academy-mysql | 2021-03-28T21:33:08.377302Z 0 [Note] InnoDB: Using CPU crc32 instructions
flutter-academy-mysql | 2021-03-28T21:33:08.384592Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
flutter-academy-mysql | 2021-03-28T21:33:08.406873Z 0 [Note] InnoDB: Completed initialization of buffer pool
flutter-academy-mysql | 2021-03-28T21:33:08.411413Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
flutter-academy-mysql | 2021-03-28T21:33:08.432067Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
flutter-academy-mysql | 2021-03-28 21:33:08 0x7f41db1c0740 InnoDB: Assertion failure in thread 139920825648960 in file ut0ut.cc line 921
flutter-academy-mysql | InnoDB: We intentionally generate a memory trap.
flutter-academy-mysql | InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
flutter-academy-mysql | InnoDB: If you get repeated assertion failures or crashes, even
flutter-academy-mysql | InnoDB: immediately after the mysqld startup, there may be
flutter-academy-mysql | InnoDB: corruption in the InnoDB tablespace. Please refer to
flutter-academy-mysql | InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
flutter-academy-mysql | InnoDB: about forcing recovery.
flutter-academy-mysql | 21:33:08 UTC - mysqld got signal 6 ;
flutter-academy-mysql | This could be because you hit a bug. It is also possible that this binary
flutter-academy-mysql | or one of the libraries it was linked against is corrupt, improperly built,
flutter-academy-mysql | or misconfigured. This error can also be caused by malfunctioning hardware.
flutter-academy-mysql | Attempting to collect some information that could help diagnose the problem.
flutter-academy-mysql | As this is a crash and something is definitely wrong, the information
flutter-academy-mysql | collection process might fail.
flutter-academy-mysql |
flutter-academy-mysql | key_buffer_size=8388608
flutter-academy-mysql | read_buffer_size=131072
flutter-academy-mysql | max_used_connections=0
flutter-academy-mysql | max_threads=151
flutter-academy-mysql | thread_count=0
flutter-academy-mysql | connection_count=0
flutter-academy-mysql | It is possible that mysqld could use up to
flutter-academy-mysql | key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68196 K bytes of memory
flutter-academy-mysql | Hope that's ok; if not, decrease some variables in the equation.
flutter-academy-mysql |
flutter-academy-mysql | Thread pointer: 0x0
flutter-academy-mysql | Attempting backtrace. You can use the following information to find out
flutter-academy-mysql | where mysqld died. If you see no messages after this, something went
flutter-academy-mysql | terribly wrong...
flutter-academy-mysql | stack_bottom = 0 thread_stack 0x40000
flutter-academy-mysql | mysqld(my_print_stacktrace+0x2c)[0x5632949b26bc]
flutter-academy-mysql | mysqld(handle_fatal_signal+0x501)[0x5632942c90c1]
flutter-academy-mysql | /lib/x86_64-linux-gnu/libpthread.so.0(+0x12730)[0x7f41db721730]
flutter-academy-mysql | /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x10b)[0x7f41db1fc7bb]
flutter-academy-mysql | /lib/x86_64-linux-gnu/libc.so.6(abort+0x121)[0x7f41db1e7535]
flutter-academy-mysql | mysqld(+0x6c40bf)[0x5632942900bf]
flutter-academy-mysql | mysqld(+0x6c449d)[0x56329429049d]
flutter-academy-mysql | mysqld(+0x11b303c)[0x563294d7f03c]
flutter-academy-mysql | mysqld(+0x11b366e)[0x563294d7f66e]
flutter-academy-mysql | mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0x312)[0x563294d86f12]
flutter-academy-mysql | mysqld(+0x11732db)[0x563294d3f2db]
flutter-academy-mysql | mysqld(_Z13buf_read_pageRK9page_id_tRK11page_size_t+0x37)[0x563294d3fb27]
flutter-academy-mysql | mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x409)[0x563294d14bd9]
flutter-academy-mysql | mysqld(_Z31trx_rseg_get_n_undo_tablespacesPm+0x13e)[0x563294cb1e9e]
flutter-academy-mysql | mysqld(+0x10b7b47)[0x563294c83b47]
flutter-academy-mysql | mysqld(_Z34innobase_start_or_create_for_mysqlv+0x2f67)[0x563294c87707]
flutter-academy-mysql | mysqld(+0xf8c9e0)[0x563294b589e0]
flutter-academy-mysql | mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x55)[0x56329431a2f5]
flutter-academy-mysql | mysqld(+0xbe3346)[0x5632947af346]
flutter-academy-mysql | mysqld(_Z40plugin_register_builtin_and_init_core_sePiPPc+0x1dc)[0x5632947b121c]
flutter-academy-mysql | mysqld(+0x6f603e)[0x5632942c203e]
flutter-academy-mysql | mysqld(_Z11mysqld_mainiPPc+0x758)[0x5632942c34e8]
flutter-academy-mysql | /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f41db1e909b]
flutter-academy-mysql | mysqld(_start+0x2a)[0x5632942b9d9a]
flutter-academy-mysql | The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
flutter-academy-mysql | information that should help you find out what is causing the crash.
flutter-academy-mysql exited with code 2
In the output is possible to see the following two message:
flutter-academy-mysql | 2021-03-28T21:33:08.432067Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800!
and then
flutter-academy-mysql | 21:33:08 UTC - mysqld got signal 6 ;
Once I comment out the volume part from the docker-compose file, the problem no longer happens. Also, if I keep the volume, but run the command with sudo, everthing runs all right. Another thing I've found out, is that if I set the host path of the volume to the root path of my project I also don't need sudo.
I've created the folders ~/dockerdata and ~/dockerdata/flutter-academy myself, so they were empty and their owner and group were fernando:fernando. After running the command sudo docker-compose up, the output of ls -l of these folders are the following:
$ ls -l ~ | grep dockerdata
drwxrwxr-x 3 fernando fernando 4096 mar 28 17:26 dockerdata
$ ls -l ~/dockerdata
total 4
drwxrwxr-x 6 999 fernando 4096 mar 28 17:55 flutter-academy
The problem here is that I'm using the docker with Intellij IDEA, and I can't use sudo in the IDE, so once I run the docker configuration, it fails.
Any ideas on what can I do to solve this problem?