[root@localhost conf]# docker search redis
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/redis Redis is an open source key-value store th... 6146 [OK]
docker.io docker.io/bitnami/redis Bitnami Redis Docker Image 97 [OK]
docker.io docker.io/sameersbn/redis 74 [OK]
docker.io docker.io/grokzen/redis-cluster Redis cluster 3.0, 3.2, 4.0 & 5.0 39
docker.io docker.io/hypriot/rpi-redis Raspberry Pi compatible redis image 34
docker.io docker.io/kubeguide/redis-master redis-master with "Hello World!" 27
docker.io docker.io/kubeguide/guestbook-redis-slave Guestbook redis slave 22
docker.io docker.io/redislabs/redis Clustered in-memory database engine compat... 16
docker.io docker.io/rediscommander/redis-commander Alpine image for redis-commander - Redis m... 15 [OK]
docker.io docker.io/arm32v7/redis Redis is an open source key-value store th... 11
docker.io docker.io/webhippie/redis Docker images for redis 9 [OK]
docker.io docker.io/oliver006/redis_exporter Prometheus Exporter for Redis Metrics. Su... 7
docker.io docker.io/rtoma/logspout-redis-logstash Logspout including Redis adapter for sendi... 5
docker.io docker.io/centos/redis-32-centos7 Redis in-memory data structure store, used... 4
docker.io docker.io/arm64v8/redis Redis is an open source key-value store th... 3
docker.io docker.io/frodenas/redis A Docker Image for Redis 2 [OK]
docker.io docker.io/wodby/redis Redis container image with orchestration 2 [OK]
docker.io docker.io/circleci/redis CircleCI images for Redis 1 [OK]
docker.io docker.io/google/guestbook-python-redis A simple guestbook example written in Pyth... 1
docker.io docker.io/kilsoo75/redis-master This image is for the redis master of SK C... 1
docker.io docker.io/tiredofit/redis Redis Server w/ Zabbix monitoring and S6 O... 1 [OK]
docker.io docker.io/anchorfree/redis redis cache server for logging 0
docker.io docker.io/cflondonservices/redis Docker image for running redis 0
docker.io docker.io/iadvize/redis 0
docker.io docker.io/xetamus/redis-resource forked redis-resource 0 [OK]

[root@localhost conf]# docker pull redis:4.0.11
Trying to pull repository docker.io/library/redis ...
4.0.11: Pulling from docker.io/library/redis
a5a6f2f73cd8: Already exists
a6d0f7688756: Pull complete
53e16f6135a5: Pull complete
106da5e40edc: Pull complete
f7cb8ce75c46: Pull complete
059508063f4f: Pull complete
Digest: sha256:ee891094f0bb1a76d11cdca6e33c4fdce5cba1f13234c5896d341f6d741034b1
Status: Downloaded newer image for docker.io/redis:4.0.11

[root@localhost conf]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/redis 4.0.11 a38ee13679d8 10 days ago 83.4 MB
docker.io/mysql 5.7.24 ae6b78bedf88 10 days ago 372 MB

创建目录和配置文件redis.conf(如果不事先创建好redis.conf则docker run的时候会自己创建一个redis.conf目录,无法自动创建配置文件)
mkdir -p /usr/local/redis/conf

cd /usr/local/redis/conf

touch redis.conf

切记redis.conf中注释掉:#daemonize yes 否则无法启动容器

[root@localhost conf]# docker run -p 6379:6379 --name redis4_0_11 --privileged=true -v /usr/local/redis/data:/data -v /usr/local/redis/conf/redis.conf:/etc/redis/redis.conf -d redis:4.0.11 redis-server /etc/redis/redis.conf --requirepass "123456" --appendonly yes
2f7358ea6c6798186058712457ad8670c4c06cd2e1bbe439670c7df28b696d2b

[root@localhost conf]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2f7358ea6c67 redis:4.0.11 "docker-entrypoint..." 4 seconds ago Up 4 seconds 0.0.0.0:6379->6379/tcp redis4_0_11
080d8084681c mysql:5.7.24 "docker-entrypoint..." 4 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql5_7_24

最后创建完后使用Redis Desktop Manager来进行测试,没问题

[root@localhost ~]# docker inspect redis4_0_11|grep -i add
"CapAdd": null,
"GroupAdd": null,
"LinkLocalIPv6Address": "",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"GlobalIPv6Address": "",
"IPAddress": "172.17.0.3",
"MacAddress": "02:42:ac:11:00:03",
"IPAddress": "172.17.0.3",
"GlobalIPv6Address": "",
"MacAddress": "02:42:ac:11:00:03"

[root@localhost ~]# docker exec -it redis4_0_11 redis-cli -h 172.17.0.3

172.17.0.3:6379> get test
(error) NOAUTH Authentication required.
172.17.0.3:6379> get list111
(error) NOAUTH Authentication required.
172.17.0.3:6379> auth 123456
OK
172.17.0.3:6379> get test
"121k2k12k"
172.17.0.3:6379> get list111
(error) WRONGTYPE Operation against a key holding the wrong kind of value
172.17.0.3:6379> lrange list111 1 2
1) "aaa"
172.17.0.3:6379> lrange list111 0 2
1) "bbb"
2) "aaa"

centos7用docker安装单节点redis4.0.11的更多相关文章

  1. redis-4.0.11主从配置初步探究

    redis-4.0.11相较于以前版本,新增了几个安全措施,稍稍研究了6379.conf配置文件,在这里记录一下. 实验环境: centos7.4 redis:redis-4.0.11 1. redi ...

  2. centos7多节点部署redis4.0.11集群

    1.服务器集群服务器 redis节点node-i(192.168.0.168) 7001,7002node-ii(192.168.0.169) 7003,7004node-iii(192.168.0. ...

  3. centos7.5 安装 redis-4.0.11

    1.下载redis包 wget wget http://download.redis.io/releases/redis-4.0.11.tar.gz 2.解压安装 #解压 .tar.gz #安装 cd ...

  4. CENTOS7下安装REDIS4.0.11

    拷贝收藏私用,别无他意,原博客地址: https://www.cnblogs.com/zuidongfeng/p/8032505.html 1.安装redis 第一步:下载redis安装包 wget ...

  5. centos7用docker安装kafka

    参考之前的文章安装zookeeper集群  https://www.cnblogs.com/xiaohanlin/p/10124674.html 如果是测试环境也可以简单安装单节点的zookeeper ...

  6. Cloudera Manager安装之利用parcels方式安装单节点集群(包含最新稳定版本或指定版本的安装)(添加服务)(CentOS6.5)(四)

    不多说,直接上干货! 福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑          ...

  7. (一)Hadoop1.2.1安装——单节点方式和单机伪分布方式

    Hadoop1.2.1安装——单节点方式和单机伪分布方式 一.   需求部分 在Linux上安装Hadoop之前,需要先安装两个程序: 1)JDK 1.6(或更高版本).Hadoop是用Java编写的 ...

  8. docker启动单节点server模式的consul | Bitdoom

    原文:docker启动单节点server模式的consul | Bitdoom docker启动单节点server模式的consul 2017-09-07 环境:MacOSX, consul_0.9. ...

  9. CentOS7利用docker安装MySQL5.7

    CentOS7利用docker安装MySQL5.7 前提条件 centos7 且内核版本高于3.10, 可通过以下命令查看内核版本 uname -r 利用yum 安装docker 安装一些必要的系统工 ...

随机推荐

  1. Oracle11gR2--SEC_CASE_SENSITIVE_LOGON参数解析

    在Oracle的11g之前的版本中密码是不区分大小写的(使用双引号强制除外). 在Oracle的11g以及以后的版本中对此有所增强.从此密码有了大小写的区分. 这个大小写敏感特性是通过SEC_CASE ...

  2. ajax 两者有什么不同

    $.ajax({            type:"POST",            url:url,            //dataType:"json" ...

  3. JBPM具体应用之decision节点的使用

    JBPM工作流引擎为我们提供了许多的节点应用,每一个节点都有其不同的作用,其中有四个比较常用的节点,他们分别decision,fork,state和task.在本文中我们先介绍decision节点,余 ...

  4. Uboot详细解析1

    uboot 详细注释讲解 声明:该贴是通过参考其他人的帖子整理出来,从中我加深了对uboot的理解,我知道对其他人一定也是有很大的帮助,不敢私藏,如果里面的注释有什么错误请给我回复,我再加以修改.有些 ...

  5. Java基础知识(二)之控制语句

    1.条件运算符   ⑴if...else... ⑵三目表达式——X?Y:Z 当X为真时,结果为Y:反之,为Z. ⑶switch(表达式){ case 1:    执行代码块 1; break: cas ...

  6. 固本培元之三:Convert、运算符、流程控制语句、ref/out/in三种参数类型

    一.Convert类常用的类型转换方法Convert.ToInt32() 转换为整型(int)Convert.ToChar() 转换为字符型(char)Convert.ToString() 转换为字符 ...

  7. php 读取和下载execl

    最近用到php 对excel 的操作 下来 小弟为大家 先贴一下自己的代码  有什么补充的 大神们请指点下.感激不尽. 我用的是yii2   yii2中有类 phpexcel 先说说下载吧. 首先下载 ...

  8. PhoneGap 3.4 开发配置及问题

    PhoneGap这个坑爹货,开发确实迅速,又无需学习新知识,但又有N多深不见底坑,最大的坑无疑是性能,滑动时卡顿明显,iPhone5上性能比较好,大部分安卓上就坑爹了,神马动画效果最好少用:其次是不同 ...

  9. Django--static静态文件引用

    需求 引用静态文件的目录不写死 "django.core.context_processors.static", html引用 1 <script src="{{ ...

  10. integer encoding vs 1-hot (py)

    https://github.com/szilard/benchm-ml/issues/1 glouppe commented on 7 May 2015 Thanks for the benchma ...