首先安装docker

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

然后安装docker-compose

apt install docker-compose

然后编辑docker-compose.yml

version: '3.3'
services:
   db:
     image: mysql:5.7
     volumes:
       - /root/mysql-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:
       - "3000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
       WORDPRESS_DB_NAME: wordpress

定义好自己的对外端口,然后 访问 http://ip:{端口} 就好了