Hi,
I’m using docker for a development environment which has a mysql image.
On my current computer, running arch linux up to date with the no chagne to the docker setup, everything is working fine but mysql that uses all the memory available.
Each time I start the container, it uses immediately all the memory of my computer.
Even the most basic use of the docker image with no database uses 16GB.
All the other containers runs fine with no issue
I’ve tried the docker library mysql image, version 8 and 5.7, the oracle version, the percona version, they all have the same issue.
I’ve tried mariadb and it works as it’s supposed, using 100 something MB.
I’ve tried the same mysql image with podman and had no issue, it uses around 200 MB.
My version of docker is:
Docker version 18.09.6-ce, build 481bc77156
Here’s the Dockerfile
FROM mysql:5.7
ENV MYSQL_ROOT_PASSWORD rootpassword
ENV MYSQL_ALLOW_EMPTY_PASSWORD=yes
ENV MYSQL_DATABASE=database
Here’s docker stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
d66ccdbd03aa boring_haibt 0.20% 14.27GiB / 15.51GiB 92.00% 1.34kB / 0B 439MB / 299MB 27
And top inside the container
top - 16:11:06 up 7:32, 0 users, load average: 0.84, 2.05, 1.42
Tasks: 2 total, 1 running, 1 sleeping, 0 stopped, 0 zombie
%Cpu(s): 5.4 us, 3.0 sy, 0.2 ni, 87.1 id, 3.3 wa, 0.9 hi, 0.2 si, 0.0 st
KiB Mem: 16262332 total, 16100992 used, 161340 free, 10252 buffers
KiB Swap: 8388604 total, 6197880 used, 2190724 free. 443820 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 mysql 20 0 17.005g 0.013t 0 S 0.0 85.0 0:05.59 mysqld
172 root 20 0 24152 2336 2000 R 0.0 0.0 0:00.15 top
I have no clue where the issue is coming from, does any one have an idea how I can troubleshoot that?
Edit:
I tried to limit the memory usage of the container using -m
and mysqld refuses to start when it is bellow 10g with the error:
ERROR: mysqld failed while attempting to check config
command was: "mysqld --verbose --help"
Edit 2:
I found something even weirder.
On the same machine, I run a Windows virtual machine using qemu-kvm.
When this machine is started, the mysql container behave normally. When this machine is not started, it use all the memory of my computer