Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用docker安装Redis #42

Open
wl05 opened this issue Jun 9, 2019 · 0 comments
Open

使用docker安装Redis #42

wl05 opened this issue Jun 9, 2019 · 0 comments

Comments

@wl05
Copy link
Owner

wl05 commented Jun 9, 2019

查看docker版本并安装

$ docker search redis
$ docker pull redis

查看镜像并启动

$ docker images
$ docker run -p 6379:6379 -v ~/redis/data:/data  -d redis redis-server --appendonly yes --requirepass "密码"

命令说明:
-p 6379:6379 : 将容器的6379端口映射到主机的6379端口
-v ~/redis/data:/data: 将主机中~/redis/data挂载到容器的/data
redis-server --appendonly yes : 在容器执行redis-server启动命令,并打开redis持久化配置
--requirepass "密码":
设置认证密码

查看运行状态

docker ps
ps -ef|grep redis

连接redis客户端

$ docker exec -it redis-dev redis-cli
$ auth '密码'
$ info

测试

$ set test 123
$ get test

docker exec -ti 0e5b redis-cli

参考资料

  1. Docker安装运行Redis
  2. Docker系列:07-安装使用redis+密码
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant