本帖最后由 alivefox 于 2022-4-5 18:04 编辑
vi docker-compose.yml
version: "3.9" services: mariadb: image: mariadb volumes: – /var/lib/mysql:/var/lib/mysql restart: always environment: MARIADB_ROOT_PASSWORD: 数据库密码 MARIADB_DATABASE: 数据库名称 MARIADB_USER: root 数据库用户 MARIADB_PASSWORD: 数据库密码 wordpress: depends_on: – mariadb links: – mariadb image: wordpress:latest volumes: – /var/www/html:/var/www/html ports: – "127.0.0.1:8081:80" restart: always environment: WORDPRESS_DB_HOST: mariadb WORDPRESS_DB_USER: root WORDPRESS_DB_PASSWORD: 数据库密码 WORDPRESS_DB_NAME: 数据库名称
使用方法: wget https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 mv docker-compose-linux-x86_64 /usr/sbin/docker-compose
cd 到docker-compose.yml目录,执行下面的命令 启动:docker-compose start 停止:docker-compose stop
在安装一个nginx 反代一下。 |