[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