How to use this image - Redis

link - https://store.docker.com/images/redis?tab=description

start a redis instance

$ docker run --name some-redis -d redis

This image includes EXPOSE 6379 (the redis port), so standard container linking will make it automatically available to the linked containers (as the following examples illustrate).

start with persistent storage

$ docker run --name some-redis -d redis redis-server --appendonly yes

If persistence is enabled, data is stored in the VOLUME /data, which can be used with --volumes-from some-volume-container or -v /docker/host/dir:/data (see docs.docker volumes).

For more about Redis Persistence, see http://redis.io/topics/persistence.

connect to it from an application

$ docker run --name some-app --link some-redis:redis -d application-that-uses-redis

... or via redis-cli

$ docker run -it --link some-redis:redis --rm redis redis-cli -h redis -p 6379

Additionally, If you want to use your own redis.conf ...

You can create your own Dockerfile that adds a redis.conf from the context into /data/, like so.

FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

Alternatively, you can specify something along the same lines with docker run options.

$ docker run -v /myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf --name myredis redis redis-server /usr/local/etc/redis/redis.conf

Where /myredis/conf/ is a local directory containing your redis.conf file. Using this method means that there is no need for you to have a Dockerfile for your redis container.

32bit variant

This variant is not a 32bit image (and will not run on 32bit hardware), but includes Redis compiled as a 32bit binary, especially for users who need the decreased memory requirements associated with that. See "Using 32 bit instances" in the Redis documentation for more information.

Image Variants

The redis images come in many flavors, each designed for a specific use case.

redis:<version>

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

redis:alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn‘t have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.

To minimize image size, it‘s uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

License

View license information for the software contained in this image.

时间: 2024-11-04 14:52:45

How to use this image - Redis的相关文章

Redis+keepalived实现双机热备

一. 简介 安装使用centos 5.6(64) Master 192.168.2.235 Slave 192.168.2.236 Vip 192.168.2.200 编译环境 yum -y install gcc gcc+ gcc-c++ openssl openssl-devel pcre pcre-devel 当 Master 与 Slave 均运作正常时, Master负责服务,Slave负责Standby: 当 Master 挂掉,Slave 正常时, Slave接管服务,同时关闭主从

Python操作数据库(mysql redis)

一.python操作mysql数据库: 数据库信息:(例如211.149.218.16   szz  123456) 操作mysql用pymysql模块 #操作其他数据库,就安装相应的模块 import  pymysql ip='211.149.218.16' port=3306 passwd='123456' user='root' db='szz' conn=pymysql.connect(host=ip,user=user,port=port,passwd=passwd,db=db,cha

Redis在Linux中安装使用

一.安装$ wget http://download.redis.io/releases/redis-x.x.x.tar.gz $ tar xzf redis-x.x.x.tar.gz $ cd redis-x.x.x $ make sudo cp mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-check-rdb redis-trib.rb redis-sentinel redis-server /usr/loca

redis 学习 四 队列

<?php /** * redis实战 * * 利用列表list实现简单队列 * * @example php cache.php */ header('content-type:text/html;chaeset=utf-8'); $redis = new \Redis(); $redis->connect('127.0.0.1', 6379); // 进队列 $userId = mt_rand(000000, 999999); $redis->rpush('QUEUE_NAME',j

Redis实战(三)Redis主从复制

从架构 1.主从架构图 2.通过命令 mkdir redisCluster创建redis集群文件夹 3.通过命令mkdir 6380   mkdir 6381   mkdir 6382在redisCluster文件夹下创建三个文件夹 4.通过以下命令将redis.conf分别拷贝到6380.6381. 6382文件夹下 cp /usr/local/redis/redis-3.0.2/redis.conf  ./6380 cp /usr/local/redis/redis-3.0.2/redis.

Redis Cluster集群部署搭建

在Oracle的路上走了许多年,换换感觉,尝试一下新的知识,也是一个不错的感觉.Redis,一个超轻量化的内存数据库,只做一小块数据库功能实现,却非常优秀的一个产品.今天,就分享一下安装Redis集群的过程. 搭建redis集群,建议至少需要准备3台服务器,共搭建6个节点,3个master,3个slave,并且要求3个master节点不能全部跑到同一台服务器上,保证节点安全,3台服务器的配置相同,使用redistest账号搭建,对应的端口是7000/7001/7002端口 我的集群分配如下,每个

redis的单机安装与配置以及生产环境启动方案

简单介绍一下redis的单机安装与配置,方便自己记录安装步骤的同时方便他人获取知识. 首先,从官网下载最新版的(稳定版)的redis安装包.官网地址如下:https://redis.io/download 下载源码包后,redis需要编译安装.需要安装gcc和tcl,gcc用于编译tcl用于测试. 使用命令安装gcc,yum install gcc,一路选择yes,gcc就可以安装成功. 接下来安装tcl,首先获取tcl源码包(见百度云盘)或者使用命令:wget http://downloads

Redis学习之Sort Set详解

本文和大家分享的主要是Redis中Sort Set相关内容,一起来看看吧,希望对大家学习redis有所帮助. 游戏服务器需要做一个排行榜实时更新,如果沿用传统的方法,一般是通过后端的定时任务去跑数据来生成排行榜数据,这种方法一方面无法满足产品对功能实时性的要求,另一方面也一定程度上消耗服务器端有限的资源.如果从每次数据库读取数据并进行排名(使用Mysql的sort关键字进行排序),在关卡数据量的级数大时是一种效率低的方法.在查阅大量资料后,发现了Redis中的有序集合(Sort Set). Re

redis 集群

redis 集群 redis集群是redis提供分布式数据库方案, 集群通过分片(Sharding)来进行数据共享,并提供复制和故障转移功能. 节点 redis集群通常由多个节点(node)组成,在开始每个node 都是相互独立的. 要组建成真正可工作的集群,我们必须将各个独立的节点连接起来,构成一个包含多个节点的集群. 命令 cluster meet <ip> <port> 向一个node 发送命令 cluster meet,让节点与ip/port所指定的节点 进行握手(hand

常见redis.conf解析

参数说明redis.conf 配置项说明如下:1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程daemonize no2. 当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定pidfile /var/run/redis.pid3. 指定Redis监听端口,默认端口为6379,作者在自己的一篇博文中解释了为什么选用6379作为默认端口,因为6379在手机按键上MERZ对应的号码