You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
65 lines
1.7 KiB
<h1><center>Docker-compose部署wordpress</center></h1>
|
|
|
|
------
|
|
|
|
**作者:行癫(盗版必究)**
|
|
|
|
## 一:环境准备
|
|
|
|
#### 1.docker-ce正常使用
|
|
|
|
#### 2.docker-compose正常使用
|
|
|
|
#### 3.镜像地址
|
|
|
|
```shell
|
|
https://share.weiyun.com/Ybc5T48m
|
|
```
|
|
|
|
## 二:容器互联
|
|
|
|
#### 编写Dockerfile文件
|
|
|
|
```shell
|
|
[root@master wordpress]# cat docker-compose.yaml
|
|
version: '3.3'
|
|
services:
|
|
mysql:
|
|
image: 10.0.0.230/xingdian/mysql@sha256:897086d07d1efa876224b147397ea8d3147e61dd84dce963aace1d5e9dc2802d
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: 123456
|
|
MYSQL_DATABASE: wordpress
|
|
MYSQL_USER: wordpress
|
|
MYSQL_PASSWORD: wordpress
|
|
wordpress:
|
|
depends_on:
|
|
- mysql
|
|
image: 10.0.0.230/xingdian/wordpress@sha256:561bff4ab02c2eee2f5e80c5c0e1832359be84f7129433d640de039ba7acd57b
|
|
ports:
|
|
- 82:80
|
|
environment:
|
|
WORDPRESS_DB_HOST: mysql
|
|
WORDPRESS_DB_USER: wordpress
|
|
WORDPRESS_DB_PASSWORD: wordpress
|
|
WORDPRESS_DB_NAME: wordpress
|
|
```
|
|
|
|
#### 启动wordpress
|
|
|
|
```shell
|
|
[root@master wordpress]# docker-compose up -d
|
|
```
|
|
|
|
#### 查看
|
|
|
|
```shell
|
|
[root@master wordpress]# docker-compose ps
|
|
Name Command State Ports
|
|
-----------------------------------------------------------------------------------------
|
|
wordpress_mysql_1 docker-entrypoint.sh mysqld Up 3306/tcp
|
|
wordpress_wordpress_1 docker-entrypoint.sh apach Up 0.0.0.0:82->80/tcp,:::82->80/tcp
|
|
```
|
|
|
|
#### 浏览器访问
|
|
|
|
<img src="D:\行癫kubernetes\Docker\Docker-compose部署wordpress.assets\image-20220820210705142.png" alt="image-20220820210705142" style="zoom:50%;" />ss |