无法从docker访问phpmyadmin

时间:2019-02-26 15:26:29

标签: docker docker-compose

我有以下docker-compose文件。

version: '3'
services:

  #PHP Service
  app:
    build:
      context: .
      dockerfile: ./vDocker/php/php.Dockerfile
    image: digitalocean.com/php
    container_name: app
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www
    volumes:
      - ./:/var/www
      - ./vDocker/.env:/var/www/.env
      - ./vDocker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
    networks:
      - app-network

  #Nginx Service
  webserver:
    image: nginx:alpine
    container_name: webserver
    restart: unless-stopped
    tty: true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./:/var/www
      - ./vDocker/.env:/var/www/.env
      - ./vDocker/nginx/conf.d/:/etc/nginx/conf.d/
    networks:
      - app-network

  #MySQL Service
  db:
    image: mysql:5.7.22
    container_name: db
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: translive
      MYSQL_ROOT_PASSWORD: gio123
      SERVICE_TAGS: dev
      SERVICE_NAME: mysql
    volumes:
      - dbdata:/var/lib/mysql/
      - ./vDocker/mysql/my.cnf:/etc/mysql/my.cnf
    networks:
      - app-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    depends_on: 
      - db
    restart: unless-stopped
    tty: true
    ports:
      - "8080:8080"
    environment:
      PMA_PORT: 3306
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: gio123
    networks:
      - app-network



#Docker Networks
networks:
  app-network:
    driver: bridge
#Volumes
volumes:
  dbdata:
    driver: local

我有4个服务。其中3个工作正常,一点问题都没有,但是phpmyadmin根本不工作。事情就是一切正常,数据库,Web服务器。但是(不是phpmyadmin)。当我尝试转到localhost:8080时,它说无法访问站点。我不知道这是怎么回事。看一下文件,也许您可​​以捕捉到一些东西。谢谢。

0 个答案:

没有答案