- 主要步骤
- 安装 Docker 和 Docker-compose
- 使用 docker-compose 搭建 wordpress 网站
- 博客网站设置
安装 Docker 和 Docker-compose
- 安装 Docker
- 安装 Docker-compose
安装 Docker
- 官网Install Docker Engine on Ubuntu
- Set up Docker’s
apt
repository.- Add Docker’s official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
- Add the repository to Apt sources:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
- Add Docker’s official GPG key:
- Install the Docker packages.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Verify that the installation is successful by running the hello-world image:
sudo docker run hello-world
安装 Docker-compose
- 安装 Docker-compose
sudo apt-get install docker-compose
- docker-compose
docker-compose --version
使用 docker-compose 搭建 wordpress
创建 docker-compose.yaml 文件
- 创建目录
mkdir wordpress
- 进入目录
cd wordpress
- 创建文件
touch docker-compose.yaml
- 编辑文件
vi docker-compose.yaml
- docker-compose.yaml 文件
version: "3.3" services: wordpres_server: image: wordpress ports: - "80:80" links: - mysql_sever environment: WORDPRESS_DB_HOST: mysql_sever WORDPRESS_DB_NAME: wordpressdb WORDPRESS_DB_USER: root WORDPRESS_DB_PASSWORD: password123qwe@ mysql_sever: image: mysql:8.0 environment: MYSQL_ROOT_PASSWORD: password123qwe@ MYSQL_DATABASE: wordpressdb
运行 docker-compose
sudo docker-compose up
Docker-compose 常用命令
站点设置
- 网站基本配置
- 网站主题
- 安装 Markdown 写作插件
网站基本配置
- 设置站点 URL
- 设置固定链接
网站主题
- GeneratePress
- 自定义主题
Markdown 插件
- Markup Markdown
- Go Live Update Urls
- All-in-One WP Migration and Backup