[root@localhost ~]# docker pull redis:5.0.3
复制代码
[root@localhost ~]# docker pull redis:5.0.3
5.0.3: Pulling from library/redis
f7e2b70d04ae: Pull complete
421427137c28: Pull complete
4af7ef63ef0f: Pull complete
b858087b3517: Pull complete
2aaf1944f5eb: Pull complete
8270b5c7b90d: Pull complete
Digest: sha256:4be7fdb131e76a6c6231e820c60b8b12938cf1ff3d437da4871b9b2440f4e385
Status: Downloaded newer image for redis:5.0.3
复制代码
[root@localhost ~]# mkdir -p /root/redis/data /root/redis/conf
[root@localhost ~]# cd redis/
[root@localhost redis]# ls
conf data
复制代码
touch redis.conf
复制代码
[root@localhost redis]# cd conf/
[root@localhost conf]# ls
[root@localhost conf]# touch redis.conf
[root@localhost conf]# ls
redis.conf
[root@localhost conf]#
复制代码
docker run -d --name redis -p 6379:6379 -v /root/redis/conf/redis.conf:/redis.conf -v /root/redis/data:/data redis:5.0.3 redis-server --appendonly yes
复制代码
####一、启动redisredis
[root@localhost ~]# docker run -d --name redis -p 6379:6379 -v /root/redis/conf/redis.conf:/redis.conf -v /root/redis/data:/data redis:5.0.3 redis-server --appendonly yes
9bc537c19ff0ad76727b5215da8cba4223c5ff97f1d9a53585d573ca71fd8c0c
docker: Error response from daemon: driver failed programming external connectivity on endpoint redis (fa297144f8d0c958288bb35a94ffbec545d348f2ff9f55a5b573f3d9a0354ace): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6379 -j DNAT --to-destination 172.17.0.3:6379 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).
复制代码
说明: docker服务启动时定义的自定义链DOCKER因为某种缘由被清掉 重启docker服务及可从新生成自定义链DOCKERdocker
####第一步、重启docker; ####第二步、启动容器;segmentfault
systemctl restart docker
docker start foo
复制代码
docker start redis
复制代码
粗暴解决方案 重启dockerbash
本人保留全部权益,转载请注明出处。
欢迎有故事、有想法的朋友和我分享,可发送至 e-mail: lwqforit@163.com微信
[1]: 1 "文章编辑专用,同步微信公众号,微信,博客园,知乎,微博,思否(segmentfault),掘金,QQapp