您的位置:首页 > 财经 > 金融 > docker-compose部署mysql+nginx+redis

docker-compose部署mysql+nginx+redis

2024/11/18 20:20:25 来源:https://blog.csdn.net/yy1209357299/article/details/139575859  浏览:    关键词:docker-compose部署mysql+nginx+redis

docker部署

参考:
docker部署mysql+nginx+redis

docker-compose部署mysql+nginx+redis

mysql

1、创建docker-compose-mysql.yml

version: "3"
services:mysql:image: mysql:5.7restart: alwayscontainer_name: mysqlports:- 3306:3306volumes:- /home/mysql/conf:/etc/mysql/conf.d- /home/mysql/data:/var/lib/mysql- /home/mysql/log:/var/log/mysql- /etc/localtime:/etc/localtime:roenvironment:MYSQL_ROOT_PASSWORD: root

2、启动和停止

docker-compose -f docker-compose-mysql.yml up -d
docker-compose -f docker-compose-mysql.yml down

nginx

1、创建docker-compose-nginx.yml

version: "3"
services:nginx:image: nginx:1.20.1restart: alwayscontainer_name: nginxports:- 8080:80volumes:- /home/nginx/html:/usr/share/nginx/html:ro- /home/nginx/conf/nginx.conf:/etc/nginx/nginx.conf- /home/nginx/conf/conf.d:/etc/nginx/conf.d- /home/nginx/log:/var/log/nginx

2、启动和停止

docker-compose -f docker-compose-nginx.yml up -d
docker-compose -f docker-compose-nginx.yml down

redis

1、创建docker-compose-redis.yml

version: "3"
services:redis:image: redisrestart: alwayscontainer_name: redisports:- 6379:6379volumes:- /home/redis/conf/redis.conf:/etc/redis/redis.conf- /home/redis/data:/datacommand: redis-server /etc/redis/redis.conf

2、启动和停止

docker-compose -f docker-compose-redis.yml up -d
docker-compose -f docker-compose-redis.yml down

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com