Docker--Redis

news/2024/12/28 23:48:51/

What is Redis?

Redis is the world’s fastest data platform. It provides cloud and on-prem solutions for caching, vector search, and NoSQL databases that seamlessly fit into any tech stack—making it simple for digital customers to build, scale, and deploy the fast apps our world runs on.

redis.io⁠

logo

Security

For the ease of accessing Redis from other containers via Docker networking, the "Protected mode" is turned off by default. This means that if you expose the port outside of your host (e.g., via -p on docker run), it will be open without a password to anyone. It is highly recommended to set a password (by supplying a config file) if you plan on exposing your Redis instance to the internet. For further information, see the following links about Redis security:

  • Redis documentation on security⁠
  • Protected mode⁠
  • A few things about Redis security by antirez⁠

How to use this image

Start a redis instance
$ docker run --name some-redis -d redis
Start with persistent storage
$ docker run --name some-redis -d redis redis-server --save 60 1 --loglevel warning

There are several different persistence strategies to choose from. This one will save a snapshot of the DB every 60 seconds if at least 1 write operation was performed (it will also lead to more logs, so the loglevel option may be desirable). 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 the official Redis documentation⁠.

Connecting via redis-cli
$ docker run -it --network some-network --rm redis redis-cli -h some-redis
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:/usr/local/etc/redis --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.

The mapped directory should be writable, as depending on the configuration and mode of operation, Redis may need to create additional configuration files or rewrite existing ones.

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.

Some of these tags may have names like bookworm in them. These are the suite code names for releases of Debian⁠ and indicate which release the image is based on. If your image needs to install any additional packages beyond what comes with the image, you'll likely want to specify one of these explicitly to minimize breakage when there are new releases of Debian.

redis:<version>-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 useful when final image size being as small as possible is your primary concern. The main caveat to note is that it does use musl libc⁠ instead of glibc and friends⁠, so software will often run into issues depending on the depth of their libc requirements/assumptions. 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

Starting on March 20th, 2024, Redis follows a dual-licensing model with the choice of the Redis Source Available License v2 - RSALv2⁠ or the Server Side Public License v1 - SSPLv1⁠. Older versions of Redis (<=7.2.4) are licensed under 3-Clause BSD⁠.

Please also view the Redis License Overview⁠ and the Redis Trademark Policy⁠.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Some additional license information which was able to be auto-detected might be found in the repo-info repository's redis/ directory⁠.

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.


http://www.ppmy.cn/news/1558921.html

相关文章

QT:一个TCP客户端自动连接的测试模型

版本 1:没有取消按钮 测试效果&#xff1a; 缺陷&#xff1a; 无法手动停止 测试代码 CMakeLists.txt cmake_minimum_required(VERSION 3.19) project(AutoConnect LANGUAGES CXX)find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Network)qt_standard_project_setup(…

寻找目标值 (最优解)

题目来源 LCR 121. 寻找目标值 - 二维数组 - 力扣&#xff08;LeetCode&#xff09; 题目描述 m*n 的二维数组 plants 记录了园林景观的植物排布情况&#xff0c;具有以下特性&#xff1a; 每行中&#xff0c;每棵植物的右侧相邻植物不矮于该植物&#xff1b;每列中&#xff0…

智慧楼盘二维、三维组件融合 720三维全景可视化

本系统通过数字孪生技术&#xff0c;实现小区楼盘系统的可视化展示&#xff0c;整合楼盘内各个系统的数据源&#xff0c;将楼盘模型与房间模型、720三维全景图相结合&#xff0c;实现了从楼盘周边到室内布局的全方位展示&#xff0c;为购房者提供全方位的可视化信息。 整个项目…

鸿蒙Next如何实现打开相册选图片功能?

问题描述&#xff1a;鸿蒙Next如何实现打开相册选图片功能 应用场景&#xff1a;用户个人中心自定义头像的时候&#xff0c;需要选择相册上传照片。 解决方案&#xff1a; 使用picker这个API实现从系统上获取相册图片这个点的&#xff0c; 1、首先要实例一个选择参数PhotoS…

《网络对抗》—— Web安全基础实践

1.实验后回答问题 &#xff08;1&#xff09;SQL注入攻击原理&#xff0c;如何防御. 原理&#xff1a; SQL注入攻击指的是通过构建特殊的输入作为参数传入Web应用程序&#xff0c;而这些输入大都是SQL语法里的一些组合&#xff0c;通过执行SQL语句进而执行攻击者所要的操作&a…

AutoFOX:一种冠状动脉X线造影与OCT的自动化跨模态3D融合框架|文献速递-视觉大模型医疗图像应用

Title 题目 AutoFOX: An automated cross-modal 3D fusion framework of coronary X-ray angiography and OCT AutoFOX&#xff1a;一种冠状动脉X线造影与OCT的自动化跨模态3D融合框架 01 文献速递介绍 冠状动脉疾病&#xff08;CAD&#xff09;仍是全球范围内的主要死亡原…

【FPGA】ISE13.4操作手册,新建工程示例

关注作者了解更多 我的其他CSDN专栏 求职面试 大学英语 过程控制系统 工程测试技术 虚拟仪器技术 可编程控制器 工业现场总线 数字图像处理 智能控制 传感器技术 嵌入式系统 复变函数与积分变换 单片机原理 线性代数 大学物理 热工与工程流体力学 数字信号处…

《操作系统真象还原》第十章(一) —— 同步机制之互斥锁实现与输出系统

本章节所有代码托管在miniOS_32 章节任务介绍 问题复现 在上一节中&#xff0c;我们实现了线程轮转调度&#xff0c;并分别实现了三个线程并发的在终端进行输出打印 主线程 thread_work_a thread_work_b #include "print.h" #include "init.h" #inc…