League2eb

Docker啟動WP

安裝Docker

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

確認有安裝好Docker

1
docker -version

安裝Docker Comopose

1
apt install docker-compose

確認有安裝好docker compose

1
docker-compose

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

1
docker-compose up -d

yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)

 評論