当前位置:网站首页>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 
边栏推荐
- $(document).Width() in WebView is a value
- Image processing code sorting
- Jetson Nano 上安装 tensorflow2.1 和 pytorch1.4
- Tensorflow2.0 (XII) -- realize simple RNN and LSTM networks
- Tips -- solve the problem of no module named matlab.engine
- webview里面$(document).width()都是一个值
- Electrotechnics self study notes 1.20
- busybox最新版(busybox apk)
- Openpcd installation process record
- 把MySQL8的数据库备份导入MySQL5版本中
猜你喜欢
![[dry goods] how to establish a close relationship between support and products?](/img/ec/bc36beb0935968fec3791910e2cb0a.png)
[dry goods] how to establish a close relationship between support and products?

硬件工程师成长之路(0)----认识元件

The best implementation of horizontal listview -- recycleview

Tensorflow2.0 (XI) -- understanding LSTM network
![[reading notes] for paper: summary of three papers in r-cnn series](/img/1d/8b862ac66ea04d9371f64e35fc4396.png)
[reading notes] for paper: summary of three papers in r-cnn series

2022 idea (student email authentication) installation and use tutorial and basic configuration tutorial

横向listview的最佳实现——RecycleView

Mysql5.7 compressed package installation tutorial

Processes, threads, semaphores, and mutexes

2.2- data type
随机推荐
概率函数P(x)、概率分布函数F(x)与概率密度函数f(x)的区别
视频号7天销售额超百万
webview里面$(document).width()都是一个值
Tips -- solve the problem of no module named matlab.engine
“3·8女王节”限时大促竟让场观、视频号销量翻倍?
OpenMV(一)--基础介绍与硬件架构
Dormant for two years! Lingsheng technology's first aiot chip released: Samsung 11nm process, integrated NPU core!
物联网在智慧城市的应用
Mmdetection3d (3) -- network output
蛰伏两年!瓴盛科技首款AIoT芯片发布:三星11nm工艺,集成NPU内核!
Strong performance growth! Wentai technology's net profit in the first half of the year was 1.7 billion yuan, a sharp increase of 767.19% year-on-year!
视频号更像是2.0版的公众号
低码在数字化转型中扮演什么角色?
com.mysql.jdbc.Driver 和 com.mysql.cj.jdbc.Driver的配置文件
The video number is more like a official account of version 2.0
Through private channels such as official account, direct the live broadcast of video number
"Queen's day on March 8" has doubled the sales of on-site viewers and video numbers?
Ren Zhengfei's latest voice: American politicians hope Huawei will die, and the desire to survive inspires Huawei
How does the video Number import the public domain traffic to the private domain
视频号运营有这个工具就够了