目录
1.Docker创建Mysql容器
2.Docker创建Redis容器
3.Docker 创建minio容器
1.Docker创建Mysql容器
拉取镜像
docker pull mysql:8.0.20
宿主机创建挂载目录
/opt/mysql/conf
/opt/mysql/data
/opt/mysql/log
启动命令
docker run --name mysql -p 3306:3306 -v /opt/mysql/data:/var/lib/mysql -v /opt/mysql/conf:/etc/mysql/conf.d -v /opt/mysql/log:/var/log/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.20
分析参考:Docker安装mysql及挂载数据卷_docker mssql 怎么 卷-CSDN博客https://blog.csdn.net/qq_45243783/article/details/121291367
2.Docker创建Redis容器
拉取镜像
docker pull redis:6.2.6
宿主机挂载目录
/opt/redis/data
/opt/redis/conf -- 创建vim redis.conf 文件和命令保持一致
/opt/redis/log
启动命令
docker run -p 6379:6379 --name redis6.2.6 -v /opt/redis/conf/redis.config:/etc/redis/redis.config -v /opt/redis/data:/var/lib/redis -v /opt/redis/log:/logs -d redis:6.2.6 redis-server /etc/redis/redis.config
分析参考:docker 安装Redis (全网最详细:附带配置文件)_docker pull redis-CSDN博客https://blog.csdn.net/javaxueba/article/details/134800960
3.Docker 创建minio容器
拉取镜像
docker pull minio/minio:RELEASE.2021-06-17T00-10-46Z-28-gac7697426
启动命令
docker run -d -p 9000:9000 --name minio \-e "MINIO_ACCESS_KEY=minio" \-e "MINIO_SECRET_KEY=minio123" \-v /path/to/data:/data \-v /path/to/config:/root/.minio \RELEASE.2021-06-17T00-10-46Z-28-gac7697426 server /data
minio分布式存储系统_minio/minio-CSDN博客https://blog.csdn.net/weixin_67573348/article/details/134630362
4.Docke 创建Nginx镜像
拉取镜像
docker pull nginx:1.24.0
宿主机挂载目录
/opt/nginx/html
/opt/nginx/log
/opt/nginx/conf
conf ,types指定挂载目录
docker run --rm nginx:1.24.0 cat /etc/nginx/nginx.conf > /opt/nginx/conf/nginx.conf
touch /opt/nginx/conf/mime.types
docker run --rm nginx:1.24.0 cat /etc/nginx/mime.types > /opt/nginx/conf/mime.types
启动命令
docker run -d -p 8090:80 \-v /opt/nginx/html:/usr/share/nginx/html \-v /opt/nginx/log:/var/log/nginx \-v /opt/nginx/conf:/etc/nginx \nginx:1.24.0