<i id='rGqfE'><tr id='rGqfE'><dt id='rGqfE'><q id='rGqfE'><span id='rGqfE'><b id='rGqfE'><form id='rGqfE'><ins id='rGqfE'></ins><ul id='rGqfE'></ul><sub id='rGqfE'></sub></form><legend id='rGqfE'></legend><bdo id='rGqfE'><pre id='rGqfE'><center id='rGqfE'></center></pre></bdo></b><th id='rGqfE'></th></span></q></dt></tr></i><div id='rGqfE'><tfoot id='rGqfE'></tfoot><dl id='rGqfE'><fieldset id='rGqfE'></fieldset></dl></div>
  • <legend id='rGqfE'><style id='rGqfE'><dir id='rGqfE'><q id='rGqfE'></q></dir></style></legend><tfoot id='rGqfE'></tfoot>

    <small id='rGqfE'></small><noframes id='rGqfE'>

      • <bdo id='rGqfE'></bdo><ul id='rGqfE'></ul>

        为什么运行docker容器后mysql数据所有权改为syste

        时间:2023-08-21
          • <tfoot id='62bU2'></tfoot>
              <tbody id='62bU2'></tbody>

            <i id='62bU2'><tr id='62bU2'><dt id='62bU2'><q id='62bU2'><span id='62bU2'><b id='62bU2'><form id='62bU2'><ins id='62bU2'></ins><ul id='62bU2'></ul><sub id='62bU2'></sub></form><legend id='62bU2'></legend><bdo id='62bU2'><pre id='62bU2'><center id='62bU2'></center></pre></bdo></b><th id='62bU2'></th></span></q></dt></tr></i><div id='62bU2'><tfoot id='62bU2'></tfoot><dl id='62bU2'><fieldset id='62bU2'></fieldset></dl></div>

                <small id='62bU2'></small><noframes id='62bU2'>

                  <bdo id='62bU2'></bdo><ul id='62bU2'></ul>

                  <legend id='62bU2'><style id='62bU2'><dir id='62bU2'><q id='62bU2'></q></dir></style></legend>
                • 本文介绍了为什么运行docker容器后mysql数据所有权改为systemd-journal-remote的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我将 mysql 数据库存储在 /home/mysql 而不是 /var/lib/mysql.该目录曾经属于 mysql.但是,当我使用这个 yml 文件运行命令 docker-compose up 时:

                  I have the mysql database stored in /home/mysql instead of /var/lib/mysql. The directory used to be owned by mysql. However, when I run the command docker-compose up with this yml file:

                  version: '3'
                  services:
                    mariadb:
                      image: mariadb
                      restart: always
                      volumes:
                       - /home/mysql:/var/lib/mysql
                    elasticsearch:
                      image: docker.elastic.co/elasticsearch/elasticsearch:5.6.4
                      environment:
                        - "ES_JAVA_OPTS=-Xms750m -Xmx750m"
                        - bootstrap.memory_lock=false
                    site:
                      build: .
                      volumes:
                        - "./app:/app"
                      links:
                        - mariadb:mysql
                      environment:
                        - DOCKER_IP=172.19.0.2
                      depends_on: ['elasticsearch','mariadb']
                      ports:
                        - "3000:3000"
                  

                  docker容器可以运行,但是/home/mysql中的整个文件夹和文件都归systemd-journal-remote所有,导致node 服务器无法连接到 mariadb.我必须停止 docker 实例,恢复 mysql 文件夹所有权并删除 ib_logfile0ib_logfile1.

                  The docker container is able to run, but the entire folder and files in /home/mysql are owned by systemd-journal-remote, which causes the node server fails to connect to mariadb. I have to stop the docker instance, restore the mysql folder ownership and delete ib_logfile0 and ib_logfile1.

                  为什么挂载/home/mysql会导致如此致命的问题?

                  Why does mounting /home/mysql cause such a fatal problem?

                  更新:

                  我的解决办法是添加user:"mysql":

                  version: '3'
                  services:
                    mariadb:
                      image: mariadb
                      restart: always
                      volumes:
                       - /home/mysql:/var/lib/mysql
                      user: "mysql"
                    elasticsearch:
                      image: docker.elastic.co/elasticsearch/elasticsearch:5.6.4
                      environment:
                        - "ES_JAVA_OPTS=-Xms750m -Xmx750m"
                        - bootstrap.memory_lock=false
                    site:
                      build: .
                      volumes:
                        - "./app:/app"
                      links:
                        - mariadb:mysql
                      environment:
                        - DOCKER_IP=172.19.0.2
                      depends_on: ['elasticsearch','mariadb']
                      ports:
                        - "3000:3000"
                  

                  推荐答案

                  您应该使用 --user 参数启动 Docker 的容器.如果您这样做并设置与 MySQL 存储的所有者相同的 uid:gid,您将不会遇到权限问题.您必须检查如何在 Docker Compose 中准确执行此操作,因为我向您展示了正常命令行执行的示例

                  You should start Docker's container with --user parameter. If you do this and set the same uid:gid as owner of the MySQL storage you will no have problems with permissions. You have to check how exactly to do this in Docker Compose because I show you example for normal command line execution

                  这篇关于为什么运行docker容器后mysql数据所有权改为systemd-journal-remote的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Archlinux mysqld 无法启动 下一篇:无法通过socket'/run/mysqld/mysqld.sock'连接本地

                  相关文章

                  最新文章

                  <small id='1CM5q'></small><noframes id='1CM5q'>

                    <bdo id='1CM5q'></bdo><ul id='1CM5q'></ul>
                • <legend id='1CM5q'><style id='1CM5q'><dir id='1CM5q'><q id='1CM5q'></q></dir></style></legend>

                      <tfoot id='1CM5q'></tfoot>
                      <i id='1CM5q'><tr id='1CM5q'><dt id='1CM5q'><q id='1CM5q'><span id='1CM5q'><b id='1CM5q'><form id='1CM5q'><ins id='1CM5q'></ins><ul id='1CM5q'></ul><sub id='1CM5q'></sub></form><legend id='1CM5q'></legend><bdo id='1CM5q'><pre id='1CM5q'><center id='1CM5q'></center></pre></bdo></b><th id='1CM5q'></th></span></q></dt></tr></i><div id='1CM5q'><tfoot id='1CM5q'></tfoot><dl id='1CM5q'><fieldset id='1CM5q'></fieldset></dl></div>