1. docker + redis

https://hub.docker.com/_/redis/

docker run -p 6379:6379 -v ~/redis/data:/data  -d redis redis-server --appendonly yes
docker exec -ti d0b86 redis-cli

docker exec -ti d0b86 redis-cli -h localhost -p 6379 
docker exec -ti d0b86 redis-cli -h 127.0.0.1 -p 6379 
docker exec -ti d0b86 redis-cli -h 172.17.0.3 -p 6379

// 注意,这个是容器运行的ip,可通过 docker inspect redis_s | grep IPAddress 查看

docker run --name redis -d -p 6379:6379 --restart=always \
    -v ~/redis/data:/data \
    -v ~/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf \
    -v ~/mysql/data:/var/lib/mysql \
    -e MYSQL_ROOT_PASSWORD=123456 \
    redis redis-server /usr/local/etc/redis/redis.conf --appendonly yes --requirepass "redis123"
作者: 雪之梦技术驿站
链接: https://snowdreams1006.github.io/devops/docker-redis.html
来源: 雪之梦技术驿站
本文原创发布于「雪之梦技术驿站」,转载请注明出处,谢谢合作!

https://snowdreams1006.github.io/snowdreams1006-wechat-open.png

© snowdreams1006 all right reserved,powered by Gitbook文件修订时间: 2020-06-03 00:46:12

results matching ""

    No results matching ""