Docker Redis

摘要:
链接-https://store.docker.com/images/redis?tab=descriptionstartaredisinstance$dockerrun--namesome-redis-drives此图像包括EXPOSE6379(其中显示),标准容器链接将自动调用
Docker Redis第1张

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.

免责声明:文章转载自《Docker Redis》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇十二、消息驱动(SpringCloud Stream)树莓派 HC-SRO4超声波测距模块的使用下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

redis的LRU算法(一)

最近加班比较累,完全不想写作了。。 刚看到一篇有趣的文章,是redis的作者antirez对redis的LRU算法的回顾。LRU算法是Least Recently Used的意思,将最近最少使用的资源丢掉。Redis经常被用作cache,如果能够将不常用的key移除,尽量保留常用的,那内存的利用率就相当高了。当然,LRU也有弱点,考虑下面一种情况: ~~~...

redis集群离线安装

环境准备: redis-4.0.7.tar.gz redis的安装包 Ruby环境(集群搭建需要用ruby创建, ruby环境在2.2以上。) rubygems-2.7.4.tgz 和 redis-3.2.2.gem (后面的是redis集群需要的ruby插件,rubygems是ruby的一个包管理工具,通过rubygems安装redis-3.2.2.g...

常规服务器配置:Prometheus+Grafana监控

准备两台测试环境: 主:192.168.28.130 备:192.168.28.131 博文大纲:一、prometheus简介二、Prometheus组成及架构三、部署prometheus1)环境准备2)部署prometheus3)配置Peometheus监控实现报警 一、prometheus简介 Prometheus是一套开源的系统监控报警框架。它以给定...

docker pull 覆盖本地镜像问题

验证: $ docker images |grep cookdata test-cache 1.0.0 fededff87eb2 About a minute ago 6.2GB (base) [wu...

CentOS7安装emq

  安装环境查看    下载rpm安装包   下载地址 https://www.emqx.io/cn/downloads    安装 rpm -ivh emqx-centos7-v3.2.1.x86_64.rpm    启动 systemctl start emqx systemctl enable emqx    web访问   ip+端口180...

Docker环境 ELK 快速部署

Docker环境 ELK快速部署 环境 Centos 7.4 , Docker version 17.12 Docker至少3GB内存; 内核配置 echo ' vm.max_map_count = 262144 net.core.somaxconn=65535 '>>/etc/sysctl.conf sysctl -p #创建elk #下...