好物优选点击查看详情 京东购买

暂无内容

【超详细】Docker快速搭建WordPress博客

环境搭建

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 -s`-`uname -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/

【超详细】Docker快速搭建WordPress博客插图

【超详细】Docker快速搭建WordPress博客插图1

原文链接:https://blog.csdn.net/weixin_45932821/article/details/115138279?ops_request_misc=&request_id=56acabfa51fe4eeca1b72e5c2ef4ddaf&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-25-115138279-null-null.268%5Ev1%5Econtrol&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞9 分享