- 建立專案目錄 例如: apmp
- 在專案目錄下新增編輯 docker-composer.yml
version: '3.3'
services:
apache-php:
image: php:7.3-apache
ports:
- "80:80"
- "443:443"
depends_on:
- mysql
volumes:
- ./www:/var/www/html
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
volumes:
- ./mysql/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: admin
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "8080:80"
depends_on:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
- 執行 docker composer
# 啟動 docker composer 並且在背景執行
docker-compose up -d
# 停止 docker composer
docker-compose stop