Estou tentando criar um site Wordpress dentro de uma pilha Docker composta pelos seguintes serviços:
-
wordpress
- o próprio site Wordpress -
db
- o contêiner MySQL
Eu tenho o seguinte stack.yml
arquivo:
version: '3.1'networks: abtehnic:services: db: image: mysql:latest restart: always networks: - abtehnic environment: MYSQL_ROOT_PASSWORD: XXXXX MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: barbu123 wordpress: image: abtehnic-wordpress depends_on: - db restart: always ports: - 80 environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_PASSWORD: barbu123 networks: - abtehnic volumes: - ./source:/var/www/html
Eu implante a pilha com o seguinte comando:
$ docker Stack deploy-c stack.yml abtehnic
O docker ps
o comando produz o seguinte:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES256e65fe2c4c mysql:latest "docker-entrypoint..." About a minute ago Up About a minute 3306/tcp abtehnic_db.1.mo0xp17adt2jocu9yivkzg19g26481d8bab95 wordpress:4.8 "docker-entrypoint..." About a minute ago Up About a minute 80/tcp abtehnic_wordpress.1.tiikrjwm1kcmxjg7v74vrcquw
Estou tentando descobrir a porta mapeada via:
$ docker port <container_id for wordpress>
e sua saída está vazia. Também quando estou correndo docker logs <container_id_for_wordpress>
Eu recebo o seguinte:
Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not knownWarning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22MySQL Connection Error: (2002) Connection refusedWarning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22MySQL Connection Error: (2002) Connection refusedMySQL Connection Error: (2002) Connection refusedWarning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.1.3. Set the 'ServerName' directive globally to suppress this messageAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.1.3. Set the 'ServerName' directive globally to suppress this message[Sat Oct 28 16:05:32.189285 2017] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.31 configured -- resuming normal operations[Sat Oct 28 16:05:32.189321 2017] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
Aqui estão minhas perguntas:
- Por que não pode o
wordpress
acesso ao contêinerdb
contentor? - Por que não há nenhuma porta que eu possa usar para acessar o site Wordpress do meu host?