777 make the mounted custom mysql config file my.cnf didn't take effect, 444 fix it when use docker image mariadb

777 make the mounted custom mysql config file my.cnf didn’t take effect, 444 fix it when use docker image mariadb

Today I add a custom config file my.cnf and mount it to docker iamge’s /etc/mysql

  ### Mariadb Container #######################################
  mariadb:
    image: mariadb:10.4
    volumes:
      - ./mariadb:/var/lib/mysql
      - ./etc/mysql/my.cnf:/etc/mysql/my.cnf
    environment:
      - MYSQL_ROOT_PASSWORD=password
    ports:
      - 3306:3306
    container_name: mariadb
    restart: always
    networks:
      - backend

But the config didn’t take effect, after some investigation, I find the permissoin of my file my.cnf is 777

After I change the permission of my.cnf to 0444(chmod 0444 my.cnf), then the config take effect.

Last modified:1 September 2019