一、安装部署Dcoker
1、安装需要的包,yum-util提供yum-config-manager功能
yum install yum-utils device-mapper-persistent-data 1vm2
2、设置yum源
yum-config-manager –add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3、安装docker
yum makecache fast
yum update
yum -y install docker-ce
4、配置daemon.json文件
mkdir /etc/docker
vim /etc/docker/daemon.json
{
“registry-mirrors”:[“https://registry.docker-cn.com”],
“insecure-registries”:[“ip:port”] #私有仓库
}
5、开启docker并设置开机自启
systemctl start docker
systemctl enable docker
二、下载镜像并创建容器
1、下载镜像
docker pull daocloud.io/library/mysql:8.0.1
docker pull wordpress
2、创建容器
创建数据库容器
docker run -di –name=mysql_boke -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root daocloud.io/library/mysql:8.0.1
创建wordpress容器并与mysql建立连接
docker run -di –name=wordpress -p 8080:80 –link mysql_boke:mysql wordpress
三、访问Wordpress
输入:IP:8080
原文链接:https://blog.csdn.net/m0_48409183/article/details/109065736?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994567316800225523234%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994567316800225523234&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-21-109065736-null-null.268%5Ev1%5Ekoosearch&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