Docker啟動WP

目錄

安裝Docker

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

確認有安裝好Docker

docker -version

安裝Docker Comopose

apt install docker-compose

確認有安裝好docker compose

docker-compose

利用docker compose把yml檔案中的描述做啟動

docker-compose up -d

yml

version: '3.3'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 80:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - ./wordpress:/var/www/html

  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - ./db:/var/lib/mysql

docker-compose.yml (END)

發佈留言