# 获取镜像 (取最新版的 Nginx 镜像)
docker pull nginx:latest
# 查看本地镜像
docker images
运行mysql实例(容器)
docker run -itd --name mysql-localhost \
-p 3306:3306 \
-v /Users/xueyueshuai/Desktop/xys/docker-data/mysql-localhost------/var/lib/mysql:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 mysql
运行redis实例(容器)
docker run -itd --name redis-localhost -p 6379:6379 redis
运行nginx实例(容器)
docker run \
--name nginx-localhost \
-p 9401:9401 \
-p 9402:9402 \
-p 9403:9403 \
-v /Users/xueyueshuai/Desktop/xys/docker-data/nginxPhpFpm------/data/wwwroots:/data/wwwroots \
-v /Users/xueyueshuai/Desktop/xys/docker-data/nginxPhpFpm------/etc/nginx/conf.d:/etc/nginx/conf.d \
--privileged=true \
-itd nginx
运行php-fpm实例(容器)
docker run --name php-fpm \
-v /Users/xueyueshuai/Desktop/xys/docker-data/nginxPhpFpm------/data/wwwroots:/data/wwwroots \
--privileged=true \
-it \
-d \
php:7.3-fpm
docker inspect --format='{{.NetworkSettings.IPAddress}}' redis-localhost
网友评论