Linux安装Redis
1.在Linux里docker安装redis
获取最新的redis镜像
docker pull redis:latest
2.查看本地是否安装redis
docker images
3.运行redis
docker run --name redis -p 6379:6379 -d --restart
=always redis redis-server --appendonly
yes --requirepass
"您的密码"
4.查看是否运行
docker
ps
5.进入Redis客户端
5.1查看docker容器id
docker
ps
5.2运行redis
docker
exec -it redis容器id redis-cli
5.3如果存在密码 – 此方法一定要执行完5.2步骤
auth 您的密码
报错处理:
Error response from daemon: driver failed programming external connectivity on endpoint redis …No chain/target/match by that name.
docker: Error response from daemon: driver failed programming external connectivity on endpoint redis (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6379 -j DNAT --to-destination ***.***.**:6379 ! -i docker0: iptables: No chain/target/match by that name.
如果是这个报错就重启docker即可
1.service docker restart
2.iptables -L