Docker:php_network_getaddresses:getaddrinfo失败:名称无法解析

时间:2019-01-29 02:41:41

标签: docker docker-swarm

我是第一次设置docker swarm,在将phpmyadmin连接到mysql数据库(x86)时遇到问题

我遇到的错误

mysqli_real_connect(): php_network_getaddresses: getaddrinfo failed: Name does not resolve*
mysqli_real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name does not resolve*

我尝试重新配置网络并切换mysql版本

version: '3.4'
networks:
  mysql:
    external: true

services:
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    environment:
      PMA_PORT: 3306
      PMA_HOST: db
      PMA_USER: root
      PMA_PASSWORD: password
    ports:
    - "8080:80"
    restart: always
    depends_on:
    - db
    networks:
    - mysql
  db:
    image: mysql:5.7
    volumes:
      - /mnt/seagate2tb/db:/var/lib/mysql
    networks:
      - mysql
    environment:
       MYSQL_ROOT_PASSWORD: password

只要学会docker swarm + compose,任何帮助都将受到赞赏!

docker network ls

NETWORK ID          NAME                DRIVER              SCOPE
339455ef7f1b        bridge              bridge              local
ba9d02ae5293        docker_gwbridge     bridge              local
ee0ee6b564e5        host                host                local
rm1jlutmki8f        ingress             overlay             swarm
kga0o20ph6zf        mysql               overlay             swarm
8209c500d790        mysql_mysql         bridge              local
8b1f5c9d50c6        none                null                local

0 个答案:

没有答案