phpmyadmin 如何使用Docker配置PHPMY ADMIN

ktecyv1j  于 2022-11-09  发布在  PHP
关注(0)|答案(1)|浏览(113)

我需要在docker-compose.yml文件中配置PHPMyAdmin?我是怎么做到的,有人能帮我吗?
先谢谢你。

rjjhvcjd

rjjhvcjd1#

这是我过去的一个项目的一部分,它使用了mysqlphpadmin
别忘了替换您自己设置变量

version: '3.5'

services:
    db:
        image: mysql:latest
        container_name: db
        ports:
          - "3306:3306"
        networks:
          internal:
            ipv4_address: 172.2.0.2
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
            MYSQL_DATABASE: wordpress
            MYSQL_USER: ${DB_USER}
            MYSQL_PASSWORD: ${DB_PASSWORD}

    phpmyadmin:
        depends_on:
          - db
        image: phpmyadmin/phpmyadmin:latest
        container_name: phpmyadmin
        ports:
          - "8001:80"
        networks:
          internal:
            ipv4_address: 172.2.0.3
        restart: always
        environment:
          - PMA_HOST=db
          - PMA_USER=${DB_USER}
          - PMA_PASSWORD=${DB_PASSWORD}
          - PMA_PORT=3306
        volumes:
          - phpmyadmin:/sessions

networks:
  internal:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.2.0.0/16

volumes:
    phpmyadmin:
        name: phpmyadmin_data

相关问题