移动位置
导入镜像
cat centos-7-x86_64.tar.gz | docker import - centos7:v1.0
查看镜像
创建安装LANM配置文件
安装检测目录工具
用法
version: '3'
services:
nginx:
hostname: nginx
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- 80:80
networks:
- lnmp
volumes:
- ./wwwroot:/usr/local/nginx/html
php:
hostname: php
build:
context: ./php
dockerfile: Dockerfile
ports:
- 9000:9000
networks:
- lnmp
volumes:
- ./wwwroot:/usr/local/nginx/html
mysql:
hostname: mysql
image: mysql:5.6
ports:
- 3306:3306
networks:
- lnmp
volumes:
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/data:/var/lib/mysql
command: --character-set-server=utf8
environment:
MYSQL_ROOT_PASSWORD: dream0324
MYSQL_DATABASE: bbs
MYSQL_USER: bbs
MYSQL_PASSWORD: dream0324
networks:
lnmp:
已守护进程方式重启
systemctl daemon-reload && systemctl restart docker
配置容器
docker-compose -f LNMP_compose.yml up -d
访问测试