Closed nkfs closed 4 years ago
According to the MySQL documentation (https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_skip_name_resolve), this should be possible via an explicit --skip-name-resolve=OFF
in the mysqld
arguments (and arguments to mysqld
are supposed to take precedence over values in the configuration files), but I tested all of mariadb:10.4
, mysql:8
, and even mysql:5.7
and it does not work as documented in any of them. :disappointed:
What I would recommend is creating for yourself a short Dockerfile
to build your own image FROM
this one with just this change:
FROM mariadb:10.4
RUN sed -i '/skip-name-resolve/d' /etc/mysql/conf.d/docker.cnf
You could also use a slightly more complex command to do it without creating a new image (example in docker run
syntax; should be easy enough to port to docker-compose
, Kubernetes, etc):
$ docker run ... mariadb:10.4 sh -c 'sed -i /skip-name-resolve/d /etc/mysql/conf.d/docker.cnf && exec docker-entrypoint.sh mysqld'
Which then successfully gives me the following from SHOW VARIABLES LIKE "%skip_name%"
:
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| skip_name_resolve | OFF |
+-------------------+-------+
Thanks, the sed command workaround worked.
I know this issue is closed, but here is another workaround. If you are using docker-compose
, you can override the docker.cnf
with your own file.
db:
image: "mariadb:10.1-bionic"
volumes:
# override docker.cnf on the image with our own
- type: bind
source: ../etc/mariadb/all.cnf
target: /etc/mysql/conf.d/docker.cnf
consistency: cached
It appears that the image starts with the option to skip-name-resolve. I can't pass a "do not" skip-name-resolve in the cmdline. My only solution is to delete the docker.cnf every time the image updates. Is there a variable we can add to the script to set it to false?