博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Docker下载Redis镜像并运行容器
阅读量:6613 次
发布时间:2019-06-24

本文共 4942 字,大约阅读时间需要 16 分钟。

hot3.png

1、搜索查找镜像

docker search redis
root@kobe:/opt/software/redis# docker search redisNAME                                  DESCRIPTION                                     STARS               OFFICIAL            AUTOMATEDredis                                 Redis is an open source key-value store that…   4638                [OK]                bitnami/redis                         Bitnami Redis Docker Image                      66                                      [OK]sameersbn/redis                                                                       61                                      [OK]tenstartups/redis-commander                                                           31                                      [OK]hypriot/rpi-redis                     Raspberry Pi compatible redis image             30                                      joshula/redis-sentinel                A container for Redis Sentinel                  20                                      kubeguide/redis-master                redis-master with "Hello World!"                19                                      kubeguide/guestbook-redis-slave       Guestbook redis slave                           15                                      webhippie/redis                       Docker images for redis                         7                                       [OK]rtoma/logspout-redis-logstash         Logspout including Redis adapter for sending…   5                                       arm32v7/redis                         Redis is an open source key-value store that…   3                                       gurpartap/redis                       Smallest redis image at 18.56MB, 5.6MB of wh…   3                                       tomesar/redis-arm                     Redis for ARM!                                  2                                       [OK]centos/redis-32-centos7               Redis in-memory data structure store, used a…   2                                       dynomitedb/redis                      Redis backend for DynomiteDB.                   1                                       [OK]vidazoohub/marathon-redis-autoscale   autoscale worker tasks based on redis size      1                                       [OK]frodenas/redis                        A Docker Image for Redis                        1                                       [OK]google/guestbook-python-redis         A simple guestbook example written in Python…   1                                       iadvize/redis                                                                         0                                       ajmath/fluentd-redis                  Use fluentd logs to send docker logs to redi…   0                                       [OK]rediscommander/redis-commander        Alpine image for redis-commander - Redis man…   0                                       [OK]kilsoo75/redis-master                 This image is for the redis master of SK Clo…   0                                       brendangibat/docker-logspout-redis    Docker Logspout container with Logspout-Redi…   0                                       [OK]anchorfree/redis                      redis cache server for logging                  0                                       sstarcher/fluent-redis-aws            https://github.com/sstarcher/docker-fluent-r…   0                                       [OK]

2、下载镜像

docker pull redis:latest

下载完成后即可查看镜像

3、查看镜像并创建redis和redis/data目录

docker images
root@kobe:/opt/software/redis# docker imagesREPOSITORY                     TAG                 IMAGE ID            CREATED             SIZEredis                          latest              1e70071f4af4        3 weeks ago         107MB

4、使用镜像创建容器

进入redis目录(redis目录下还有data目录,用于redis数据持久化的存储)

docker run -p 6379:6379 -v $PWD/data:/data -d redis:latest redis-server --appendonly yes

-p   6379:6379 :将容器的6379端口映射到主机的6379端口

-v   $PWD/data:/data :将主机中当前目录下的data挂载到容器的/data
redis-server --appendonly yes  在容器执行redis-server启动命令,并打开redis持久化配置

5、进入容器操作redis

docker run -it redis:latest redis-cli -h 192.168.163.170
root@kobe:/opt/software/redis# docker run -it redis:latest redis-cli -h 192.168.163.170192.168.163.170:6379> info# Serverredis_version:4.0.6redis_git_sha1:00000000redis_git_dirty:0redis_build_id:f1060815dd32471aredis_mode:standaloneos:Linux 4.10.0-42-generic x86_64.................# Clustercluster_enabled:0# Keyspace192.168.163.170:6379> exitroot@kobe:/opt/software/redis#

退出后,重新执行第五步即可重新进入容器操作redis容器

此时使用docker ps即可查看到运行的容器

root@kobe:/opt/software/redis# docker psCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                        NAMESe981e149e349        redis:latest        "docker-entrypoint.s…"   11 minutes ago      Up 11 minutes       0.0.0.0:6379->6379/tcp                       dazzling_kowalevski

 

转载于:https://my.oschina.net/xiaozhiwen/blog/1602628

你可能感兴趣的文章
Docker运行程序报错 WARNING: IPv4 forwarding is disabled. Networking will not work
查看>>
[Selenium] IOS 之 ios-driver
查看>>
文本输入的几种特殊验证方式
查看>>
BZOJ3195:[JXOI2012]奇怪的道路——题解
查看>>
BZOJ4034:[HAOI2015]树上操作——题解
查看>>
47. Ext.form.Field.prototype.msgTarget
查看>>
jsp显示计算数值, 四舍五入
查看>>
HTML和CSS疑点解析
查看>>
剑指offer 快速排序
查看>>
Java Socket编程入门
查看>>
PropertyGrid排序
查看>>
20款PHP版WebMail开源项目
查看>>
4-4 Selector有一个方法可以获取Selector中的文本内容---extract()
查看>>
字符串属性和函数的使用
查看>>
sql备份还原错误-媒体集有2个媒体簇,但只提供了1个
查看>>
不展现报表实现对报表的打印导出
查看>>
NVIDIA Jetson TX2 通过JetPack 3.1刷机后不能启动连网问题解决
查看>>
倒计时 功能
查看>>
01-C#入门(函数一)
查看>>
C++虚函数表理解
查看>>