最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

超详细Docker快速搭建WordPress博客

XAMPP教程 admin 177浏览 0评论

环境搭建
linux版本:Centos7.2

Docker安装

软件包安装

yum install -y yum-utils device-mapper-persistent-data lvm2
设置Docker镜像仓库

wget -O /etc/yum.repos.d/docker.repo https://download.docker.com/linux/centos/docker-ce.repo
更新

yum makecache fast
安装最新版本的docker

yum install docker-ce -y
启动docker并设置开机自启动

systemctl restart docker
systemctl enable docker
查看是否安装成功

[root@liuhang yum.repos.d]# docker version
Client: Docker Engine – Community
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:17:48 2020
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine – Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:16:13 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0xxxxxxxxxx [root@liuhang yum.repos.d]# docker versionClient: Docker Engine – Community Version: 20.10.2 API version: 1.41 Go version: go1.13.15 Git commit: 2291f61 Built: Mon Dec 28 16:17:48 2020 OS/Arch: linux/amd64 Context: default Experimental: trueServer: Docker Engine – Community Engine: Version: 20.10.2 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: 8891c58 Built: Mon Dec 28 16:16:13 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.4.3 GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc: Version: 1.0.0-rc92 GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff docker-init: Version: 0.19.0 GitCommit: de40ad0docker version
配置阿里云镜像加速器

mkdir -p /etc/docker
rm -rf /etc/docker/daemon.json
cat >>/etc/docker/daemon.json<<eof
{
“registry-mirrors”: [“https://5ke62mgb.mirror.aliyuncs.com”]
}
eof
systemctl daemon-reload
systemctl restart docker
Docker-compose安装

使用国内镜像

curl -L https://get.daocloud.io/docker/compose/releases/download/1.24.0/docker-compose-uname -suname -m > /usr/local/bin/docker-compose
授权

chmod 777 /usr/local/bin/docker-compose
查看docker-compose版本

[root@controller ~]# docker-compose version docker-compose version 1.24.0, build 0aa59064
docker-py version: 3.7.2
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
WordPress博客搭建
创建一个文件夹并进入

[root@controller ~]# mkdir my_wordpress
[root@controller ~]# cd my_wordpress/
[root@controller my_wordpress]#
编写docker-compose文件

cat >>docker-compose.yml<<eof
version: ‘3.3’

services:
db:
image: mysql:5.7
volumes:
– db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
depends_on:
– db
image: wordpress:latest
ports:
– “8000:80”
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
db_data: {}
eof
启动
docker-compose up

访问测试
主机IP:8000

我的主机IP为192.168.100.10

浏览器访问—>>http://192.168.100.10:8000/


————————————————
版权声明:本文为CSDN博主「小航冲冲冲」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_45932821/article/details/115138279

转载请注明:XAMPP中文组官网 » 超详细Docker快速搭建WordPress博客

您必须 登录 才能发表评论!