Redis 6 available as container, is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. You can run atomic operations on these types, like appending to a string; incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; or getting the member with highest ranking in a sorted set. In order to achieve its outstanding performance, Redis works with an in-memory dataset. Depending on your use case, you can persist it either by dumping the dataset to disk every once in a while, or by appending each command to a log.
For this, we will assume that you are using the rhel8/redis-6
image.
If you want to set only the mandatory environment variables and not store
the database in a host directory, execute the following command:
$ podman run -d --name redis_database -p 6379:6379 rhel8/redis-6
This will create a container named redis_database
. Port 6379 will be exposed and mapped
to the host.
If you want your database to be persistent across container executions, also add a
-v /host/db/path:/var/lib/redis/data:Z
argument. This will be the Redis data directory.
For protecting Redis data by a password, pass REDIS_PASSWORD
environment variable
to the container like this:
$ podman run -d --name redis_database -e REDIS_PASSWORD=strongpassword rhel8/redis-6
Warning: since Redis is pretty fast an outside user can try up to 150k passwords per second against a good box. This means that you should use a very strong password otherwise it will be very easy to break.
REDIS_PASSWORD
Password for the server access
You can also set the following mount points by passing the -v /host:/container:Z
flag to podman.
/var/lib/redis/data
Redis data directory
Notice: When mouting a directory from the host into the container, ensure that the mounted directory has the appropriate permissions and that the owner and group of the directory matches the user UID or name which is running inside the container.
Redis logs into standard output, so the log is available in the container log. The log can be examined by running:
podman logs <container>
Dockerfile and other sources for this container image are available on
https://github.com/sclorg/redis-container.
In that repository you also can find another versions of Python environment Dockerfiles.
Dockerfile for CentOS is called Dockerfile
, Dockerfile for RHEL7 is called Dockerfile.rhel7
,
for RHEL8 it's Dockerfile.rhel8
and the Fedora Dockerfile is called Dockerfile.fedora.
Use the following instructions to get images from a Red Hat container registry using registry service account tokens. You will need to create a registry service account to use prior to completing any of the following tasks.
First, you will need to add a reference to the appropriate secret and repository to your Kubernetes pod configuration via an imagePullSecrets field.
Then, use the following from the command line or from the OpenShift Dashboard GUI interface.
Use the following command(s) from a system with podman installed
Use the following command(s) from a system with docker service installed and running
Use the following instructions to get images from a Red Hat container registry using your Red Hat login.
For best practices, it is recommended to use registry tokens when pulling content for OpenShift deployments.
Use the following command(s) from a system with podman installed
Use the following command(s) from a system with docker service installed and running
Source code is available for all Red Hat UBI-based images in the form of downloadable containers. Here are a few things you should know about Red Hat source containers.
Use skopeo to copy the source image to a local directory
Inspect the image
Untar the contents
Begin examining and using the content.
The Red Hat Ecosystem Catalog is the official source for discovering and learning more about the Red Hat Ecosystem of both Red Hat and certified third-party products and services.
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.