Estou tentando criar um site do Wordpress dentro de uma pilha do Docker composta pelos seguintes serviços:
-
wordpress
- o próprio site Wordpress
-
db
- o contêiner do MySQL
Eu tenho o seguinte arquivo stack.yml
:
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 implanto a pilha com o seguinte comando:
$ pilha do docker deploy -c stack.yml abtehnic
O comando docker ps
gera o seguinte:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
256e65fe2c4c mysql:latest "docker-entrypoint..." About a minute ago Up About a minute 3306/tcp abtehnic_db.1.mo0xp17adt2jocu9yivkzg19g
26481d8bab95 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 por meio de:
$ docker port <container_id for wordpress>
e sua saída está vazia. Além disso, quando estou executando docker logs <container_id_for_wordpress>
, obtenho o seguinte:
Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22
Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22
MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22
MySQL Connection Error: (2002) Connection refused
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22
MySQL Connection Error: (2002) Connection refused
MySQL Connection Error: (2002) Connection refused
Warning: mysqli::mysqli(): (HY000/2002): Connection refused in - on line 22
AH00558: 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
AH00558: 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 o contêiner
wordpress
não pode acessar o contêiner db
?
- Por que não há nenhuma porta que eu possa usar para acessar o site do Wordpress do meu host?