version: '3'

services:
  mysql-master:
    image: mysql:5.7
    container_name: mysql-master
    networks:
      yewu-network:
        ipv4_address: 192.168.177.51
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: HVSfrZlryFjcpIvW
    entrypoint:
      - sh
      - -euc
      - |
        cat <<'EOF'> /etc/my.cnf
        [mysqld]
        skip-host-cache
        skip-name-resolve
        datadir=/var/lib/mysql
        socket=/var/run/mysqld/mysqld.sock
        secure-file-priv=/var/lib/mysql-files
        user=mysql
        symbolic-links=0
        pid-file=/var/run/mysqld/mysqld.pid
        server-id=1
        log_bin=mysql-bin
        binlog_format=ROW
        [client]
        socket=/var/run/mysqld/mysqld.sock
        !includedir /etc/mysql/conf.d/
        !includedir /etc/mysql/mysql.conf.d/
        EOF
        docker-entrypoint.sh mysqld --innodb-buffer-pool-size=2G --innodb-log-file-size=256M
    ports:
      - 3306:3306
    volumes:
      - ./mysql-master-data:/var/lib/mysql

networks:
  yewu-network:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.177.0/24
    name: yewu-network
最后修改:2023 年 11 月 03 日
如果觉得我的文章对你有用,请随意赞赏