人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

docker安裝redis5.0.3的方法步驟

發(fā)布日期:2022-02-18 18:15 | 文章來源:CSDN

一、拉取官方5.0.3鏡像

[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

二、創(chuàng)建掛載目錄

1、創(chuàng)建掛載文件夾

[root@localhost ~]# mkdir -p /root/redis/data /root/redis/conf
[root@localhost ~]# cd redis/
[root@localhost redis]# ls
conf data

2、創(chuàng)建redis.conf

在/root/redis/conf目錄中創(chuàng)建文件 redis.conf

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]# 

三、創(chuàng)建redis 容器

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

參數(shù)說明:

-d 后臺運行

-p 端口映射到主機的端口

-v 將主機目錄掛載到容器的目錄

redis-server --appendonly yes : 在容器執(zhí)行redis-server啟動命令,并打開redis持久化配置

1、啟動redis

啟動中報錯如下:

[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服務及可重新生成自定義鏈DOCKER

解決方案:

第一步、重啟docker;

第二步、啟動容器;

systemctl restart docker
docker start foo

2、容器創(chuàng)建成功,啟動redis容器

docker start redis

1、啟動失敗問題:啟動容器就會出現(xiàn)iptables: No chain/target/match by that name出錯

粗暴解決方案
重啟docker

2、正常啟動啟動顯示

四、客戶端連接

我用的 RedisDesktopManager


以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持本站。

香港服務器租用

版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學習參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務

7x24全年不間斷在線

專屬顧問服務

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務熱線

關(guān)注
微信

關(guān)注官方微信
頂部