Redis 官方 Docker 镜像,提供开箱即用的高性能键值数据库服务,适合作为缓存、会话存储、消息队列和排行榜等场景的基础组件,支持持久化与多架构部署,适合本地开发与生产环境按需扩展使用。

1.4万 次收藏下载次数: 0状态:Docker 官方镜像维护者:Docker 官方镜像仓库类型:镜像最近更新:
下载命令
点击查看

Quick reference

  • Maintained by:
    https://redis.io/

  • Where to get help:
    https://dockr.ly/comm-slack, Server Fault, https://unix.stackexchange.com/help/on-topic, or https://stackoverflow.com/help/on-topic

Supported tags and respective Dockerfile links

  • https://github.com/redis/docker-library-redis/blob/8104e63b5910fda751bf7c038fa297b6fb19ff43/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/8104e63b5910fda751bf7c038fa297b6fb19ff43/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/***eeec647317654725705506aaf25e1c08ac1/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/***eeec647317654725705506aaf25e1c08ac1/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/fe1a01e927da9ef295cc31077d8864d23375a03a/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/fe1a01e927da9ef295cc31077d8864d23375a03a/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/835e326fd8f8a667b18f***b548b***f645a/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/835e326fd8f8a667b18f***b548b***f645a/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/78ec6fbd0dcf6ea97b4828244ae5f7ec4d04d01a/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/78ec6fbd0dcf6ea97b4828244ae5f7ec4d04d01a/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/74654c612ee06275377d483dc4e134e57b463e9e/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/74654c612ee06275377d483dc4e134e57b463e9e/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/09aa4e1a1bb278b1ad77bdeb43bde981fad64e49/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/09aa4e1a1bb278b1ad77bdeb43bde981fad64e49/alpine/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/d452a755b3fa51c0a8d26e254f29a25bf2272e3c/debian/Dockerfile

  • https://github.com/redis/docker-library-redis/blob/d452a755b3fa51c0a8d26e254f29a25bf2272e3c/alpine/Dockerfile

Quick reference (cont.)

  • Where to file issues:
    https://github.com/redis/docker-library-redis/issues?q=is:issue+is:pr

  • Supported architectures: (https://github.com/docker-library/official-images#architectures-other-than-amd64)
    https://hub.docker.com/r/amd64/redis/, https://hub.docker.com/r/arm32v5/redis/, https://hub.docker.com/r/arm32v6/redis/, https://hub.docker.com/r/arm32v7/redis/, https://hub.docker.com/r/arm64v8/redis/, https://hub.docker.com/r/i386/redis/, https://hub.docker.com/r/ppc64le/redis/, https://hub.docker.com/r/riscv64/redis/, https://hub.docker.com/r/s390x/redis/

  • Published image artifact details:
    https://github.com/docker-library/repo-info/blob/master/repos/redis (https://github.com/docker-library/repo-info/commits/master/repos/redis)
    (image metadata, transfer size, etc)

  • Image updates:
    https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fredis
    https://github.com/docker-library/official-images/blob/master/library/redis (https://github.com/docker-library/official-images/commits/master/library/redis)

  • Source of this description:
    https://github.com/docker-library/docs/tree/master/redis (https://github.com/docker-library/docs/commits/master/redis)

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.

https://redis.io

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:

  • https://redis.io/docs/latest/operate/oss_and_stack/management/security/
  • https://redis.io/docs/latest/operate/oss_and_stack/management/security/#protected-mode
  • A few things about Redis security by antirez

Process User and Privileges

By default, the Redis Docker image drops privileges by switching to the redis user and removing unnecessary capabilities. This step is skipped if Docker is run with the --user option or if you set the SKIP_DROP_PRIVS=1 (since 8.0.2) environment variable.

Note: Using SKIP_DROP_PRIVS is not recommended, as it reduces the container's security.

How to use this image

Start a redis instance

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

Start with persistent storage

console
$ 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 https://docs.docker.com/engine/tutorials/dockervolumes/).

For more about Redis persistence, see https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/.

File and Directory Permissions

Redis will attempt to correct the ownership and permissions of the data and configuration (since 8.0.2) directories and files if they are not set correctly. This adjustment is only performed in basic, default scenarios to avoid interfering with custom or user-specific configurations.

You can skip this step by setting the SKIP_FIX_PERMS=1(since 8.0.2) environment variable.

Manually Setting File and Directory Permissions

If you prefer to handle file permissions yourself, you can use a docker run command to set the correct ownership on mounted volumes. For example:

console
$ docker run --rm -v /your/host/path:/data redis chown -R redis:redis /data

Connecting via redis-cli

console
$ 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.

dockerfile
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.

console
$ 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 or trixie in them. These are the suite code names for releases of https://wiki.debian.org/DebianReleases 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 [***] available in https://hub.docker.com/_/alpine. 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 https://musl.libc.org instead of https://www.etalabs.net/compare_libcs.html, 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 https://hub.docker.com/_/alpine/ for examples of how to install packages if you are unfamiliar).

License

Starting with Redis 8.0, Redis follows a tri-licensing model with the choice of the https://redis.io/legal/rsalv2-agreement/, https://redis.io/legal/server-side-public-license-sspl/, or the https://opensource.org/license/agpl-v3. Prior versions of Redis (<=7.2.4) are licensed under https://opensource.org/license/bsd-3-clause⁠, and Redis 7.4.x-7.8.x are licensed under the dual https://redis.io/legal/rsalv2-agreement/ or https://redis.io/legal/server-side-public-license-sspl/ license.

Please also view the https://redis.io/legal/licenses/ and the https://redis.io/legal/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 https://github.com/docker-library/repo-info/tree/master/repos/redis.

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.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 redis 镜像标签

docker pull docker.xuanyuan.run/redis:<标签>

DockerHub 原生拉取命令

docker pull redis:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告