This is just a quick note on how to run Redis as a container using Podman on Ubuntu 22.04 (i.e. there will be no mention about SELinux.)

Create a persistent volume for the Redis container

I like storing all data/volume for containers under /srv/data. So I’ll create a sub-directory called redis-data under the same location.

# mkdir -p /srv/data/redis-data

Pull the Redis image

# podman pull

Create and run the Redis container

# podman run -d --name redis_server \
    -v /srv/data/redis-data:/var/redis/data \
    -p 6379:6379 redis

Create systemd service for the Redis container

I like creating a systemd service to enable/start the container.

# podman generate systemd --name redis_server --files --new

# mv container-redis_server.service /etc/systemd/system/
# systemctl daemon-reload

Before using the systemd to start the container, I need to remove the old container which was run manually.

# podman stop redis_server
# podman rm redis_server

Enable and start the Redis container using systemd service

# systemctl start container-redis_server.service
# systemctl status container-redis_server.service
# systemctl enable container-redis_server.service

That’s all. I now have Redis server running on a (Podman) container.