Closed jones1008 closed 2 years ago
Thanks for filing a bug report! Will investigate and try to reproduce.
added a fix in PR #57
I haven't been able to reproduce this. Is it happening 100% of the time for you?
I just reproduced this on another Windows machine... It still starts with port: 0
when the container imports the ./db/test.sql
, so I guess it is happening 100% of the time:
init: installing mysql client
init: updating system tables
init: adding /docker-entrypoint-initdb.d/test.sql
init: removing mysql client
[...]
Version: '10.4.15-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 0 MariaDB Server
Please note, that I am using the image version 10.4.15
in my docker-compose.yml
and not the latest version 10.4.17
.
Also: It didn't matter if I used the WSL2 based docker engine on Windows or the Hyper-V version, same problem for both...
Ok, thanks for verifying. Since I aim to maintain latest branches of 10.4.x, 10.5.x (and possibly 10.3, 10.2); I'm unsure if I should merge a patch for a bug that's fixed upstream. What do you think?
Well, if you want to support multiple branches of mariadb I think you want to fix this...
And since the default value of --skip-networking
is OFF
anyway and I am only explicitly calling mysqld with this flag set to false
in my PR, I don't see a reason not to merge this.
I see this same issue on my Windows machine using WSL2, with both image versions 10.1.16 and 10.5. What is the workaround?
Version: '10.5.15-MariaDB-1:10.5.15+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 0 mariadb.org binary distribution
compose file:
db:
image: mariadb:10.5
restart: always
env_file:
- ./db.env
volumes:
- ./db/init:/docker-entrypoint-initdb.d
ports:
- 3309:3306`
I also noticed that when I run bash in my db container and get a process list, I see the '--skip-networking' flag
root@8327183c80f5:/# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
mysql 1 0.0 0.0 4352 3516 ? Ss 14:38 0:00 /bin/bash /usr/local/bin/docker-entrypoint.sh mysqld
mysql 104 79.4 6.0 1861904 242776 ? Sl 14:38 2:38 mysqld --skip-networking --default-time-zone=SYSTEM --socket=/run/mysqld/mysqld.sock --wsrep_on=OFF --loose-innodb_buffer_pool_load_at_startup=0
I noticed that my docker-compose file and @jones1008 both were using the docker-entrypoint-initdb.d option so I just tested with commenting this out and mysqld runs on port 3306.
docker-compose output
db_1 | 2022-05-09 14:55:37 0 [Note] mysqld: ready for connections.
db_1 | Version: '10.5.15-MariaDB-1:10.5.15+maria~focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
docker-compose file
db:
image: mariadb:10.5
restart: always
env_file:
- ./db.env
# volumes:
# - ./db/init:/docker-entrypoint-initdb.d
ports:
- 3309:3306
Here is the process list from the db container
root@c8df207a315a:/# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
mysql 1 0.0 2.0 1345568 84476 ? Ssl 14:55 0:00 mysqld
root 157 1.5 0.0 4244 3516 pts/0 Ss 15:03 0:00 bash
root 165 0.0 0.0 5896 2872 pts/0 R+ 15:03 0:00 ps aux
Sorry for lagging behind here; its hard for me to reproduce it since I don't have any windows environments. I will see if I can get a VM going this weekend to debug this further.
Was hoping to get tests going in github actioins but are at a loss on how to set up a full environment. Any input much appreciated!
I faced with the same issue on podman (3.0.1 on Debian 11, and 4.2.1 on Fedora 36):
podman run --rm --env-file=init.env --pod=mariadb-pod --volume=$HOME/Development/camilla/dockerfiles/mariadb-alpine/init:/docker-entrypoint-initdb.d --volume=mariadb-data:/var/lib/mysql --name mariadb docker.io/jbergstroem/mariadb-alpine
Without /docker-entrypoint-initdb.d
mounting, it works correctly.
Without /docker-entrypoint-initdb.d mounting, it works correctly.
That's very interesting. Will try to reproduce.
I'm just gonna remove --skip-networking
. It is an unnecessary optimization. I'm not able to reproduce this or confirm that the temporary mysqld spun up is polluting a config somehow, but its clearly unnecessary.
Ok, pushed the change. Let me know if that works for you (should you be in a position to test main
- otherwise wait for next release!).
Guys can you please help me ? Seems to be impossible to set this as 0 or false ! skip-networking=TRUE
please help me to understan how to do that ?
any help will be appreaciate it. thanks in advance !
@darkhacknet I removed the flag from the container. Are you on 10.6.10
? What issues are you facing? Could you open a new issue so we can track it separately?
I have the following
docker-compose.yml
setup:At intial startup it loads the file
./db/test.sql
into the databasetest
. After the container starts, I try to connect to it with a localmysql
client installation:and on the Docker output I get:
Note the port is set to
0
instead of3306
. A quick search states that--skip-networking
might be enabled. And in fact thesh/run.sh
script starts the temporary mysql daemon with the--skip-networking
flag to import mytest.sql
.My guess is that
mysqld
somehow saves the variableskip-networking
internally and keeps it toTRUE
when executingmysqld
in the last line ofrun.sh
A solution might be to explicitly set
--skip-networking=FALSE
in the last line ofrun.sh
. Might be filing a PR soon.Also note that somehow this is not an issue in the latest mariadb version 10.4.17... So changing the
docker-compose.yml
to the following fixes the issue: