0
我試圖設置使用docker-compose.yml
爲WordPress開發碼頭工人,容器,看起來像這樣:WordPress的碼頭工人撰寫不會啓動mysql
version: '3'
services:
db:
image: mysql:5.7
volumes:
- data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
MYSQL_USER: root
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- 8080:80
- 443:443
volumes:
- ./data:/data # Required if importing an existing database
- ./:/var/www/html # Theme development
environment:
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: root
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:80
volumes:
data: {}
而且我得到這樣的錯誤:
wordpress_1 | Warning: mysqli::mysqli(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22
wordpress_1 |
wordpress_1 | Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 22
wordpress_1 |
wordpress_1 | MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
我試圖清除我的圖像和容器,但沒有運氣。任何想法爲什麼發生這種情況
您不必提供WORDPRESS_DB_HOST上的端口 – veelen
不可以,也沒有幫助 –
可能您需要在您的'db'服務中提供端口 – Ayushya