当前位置:网站首页>Centos8 uses docker to install WordPress in wordpress+mysql configuration file_ DB_ Understanding of host
Centos8 uses docker to install WordPress in wordpress+mysql configuration file_ DB_ Understanding of host
2022-07-28 18:10:00 【Ripo_ za】
This blog mentioned that I follow docker Official website installation wordpress Problems encountered . Maybe it's centos8 Unique problems . After understanding, I'm sure it's not docker Official website composse Documentation issues . Here's what I'm thinking about compose The understanding of the .
below compose The document is almost the same as the official , It's just volumes It's a little different .
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- ./db_data:/var/lib/mysql
restart: always
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
# It's the same as here mysql Corresponding .
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
volumes:
- ./wordpress:/var/www/html
environment:
# there db On behalf of the above mysql Container host
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {
}
wordpress:
It mainly depends on WORDPRESS_DB_HOST Field , This field corresponds to wp-config.php Medium DB_HOST field value . There are three ways to fill in this value , But the latter two are only workable , Don't actually do this .
(1) there db Refers to mysql service (ip+ Default 3306 port , If it is anything else, it should be clearly pointed out ), The following port refers to mysql The corresponding port in the container . If it is 3006 You can also omit the words . But it's better to mysql and wordpress Both indicate , Be clear .
(2) According to the first point , If you change wp-config.php Medium DB_HOST The field values for mysql Container of ip+ Ports can also run , It can be changed into 172.19.0.2:3306.
(3) The second point can also be written as run wordpress Of a container default gateway +mysql Stealth port . According to the figure below , It can be written. 172.19.0.1:3307.
The implementation of the latter two methods requires Mr. into two containers , Then query the corresponding Gataway Variable , And then modify wordpress Corresponding wp-config.php Just watch . This is just a way to run , But don't do it . And after re running the container ,wp-config.php The value of will change back .
The same compose The containers where the files run are all under the same gateway . See the picture below .
(1)wordpress Output inspect Some information 
(2)mysql Part of the output information 
边栏推荐
- Overflow failure of mobile terminal
- The video number is more like a official account of version 2.0
- Electrotechnics digital circuit self study notes 1.24
- Leetcode systematic question brushing (4) -- hash table and string
- 做好视频号需要的特质
- 1.2-hexadecimal conversion
- [dry goods] how to establish a close relationship between support and products?
- Fluent: exception handling
- 通过公众号等私域渠道,为视频号直播引流
- centos8按照docker官网创wordpress+mysql报错解决
猜你喜欢

Tips -- understanding of the physical meaning of convolution

Digital filter (VI) -- design FIR filter

OpenMV(三)--实时获取摄像头图片

Leetcode systematic question brushing (II) -- greed, backtracking, recursion

Leetcode--45. jumping game II (greed)

横向listview的最佳实现——RecycleView

mysql5.7压缩包安装教程

概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别

Mysql5.7 compressed package installation tutorial

进程、线程、信号量和互斥锁
随机推荐
马斯克利用活猪展示全新脑机接口技术:可实时读取猪脑信息
概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
[dry goods] how to establish a close relationship between support and products?
10.8亿美元!TCL科技收购三星苏州8.5代线:未来一年产能将增长60%!
mysql5.7压缩包安装教程
Video number from 2-3 games per week to 3 games per day
任正非最新发声:美国政治家希望华为死,求生欲使华为振奋起来
Openmv (I) -- basic introduction and hardware architecture
联发科已向美方提交申请,力求9月15日后仍可向华为供货
视频号、公众号间导流便捷可观
OpenMV(四)--STM32实现特征检测
Sales of video related products increased by 88%
计算机组成原理核心知识点总结&面试笔试要点[通俗易懂]
Compilation principle learning notes 1 (compilation principle overview and lexical analysis)
word文档删除最后一页
Openmv (II) -- ide installation and firmware download
[reading notes] for paper: summary of three papers in r-cnn series
Self study notes of electrical engineering, data and electricity 1.25
2.1 operator
centos8按照docker官网创wordpress+mysql报错解决