How to persist Redis data in Azure Container Instances

M. Ebad Ullah Khan 5 Reputation points


I'm currently working with Azure Container Instances and the Azure Docker Registry to deploy a Redis image. The setup is working well, but I'm facing an issue with data persistence. Whenever the container instance restarts due to errors or other issues, all the data in my Redis instance is getting removed, which is not the behavior I want.

I've done some research and found that Redis can be configured to persist data by setting some fields in redis.conf file. I created a custom redis.conf file with the necessary configuration for data persistence. However, since I started using this custom redis.conf file, the Redis image no longer functions. No error logs are appearing on my local Docker desktop (even on the docker container instance), yet the Redis functionality remains non-functional.

I'm looking for guidance on how to properly configure Redis with a redis.conf file for data persistence while ensuring that the image remains operational. Any assistance or insights on what might be causing this issue would be greatly appreciated.

Thank you for your time and support.

Best regards,

Ebad Ullah

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
194 questions
{count} vote

2 answers

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 24,197 Reputation points Microsoft Employee

    @M. Ebad Ullah Khan Welcome to Microsoft Q&A thanks for posting your question

    If you are looking for persisting data, you can always consider using the managed Azure Cache for Redis service in Azure. The distributed caching will be outside of the Azure Container instance and will have data persistent features built in. What is Azure Cache for Redis? - Azure Cache for Redis | Microsoft Learn

    Which docker image do you use for your container instance? How redis.conf file is used may depend on the docker image implementation. You can refer to Redis configuration | Redis for guidance.

    I hope this information helps



  2. GeethaThatipatri-MSFT 24,197 Reputation points Microsoft Employee

    Hi @M. Ebad Ullah Khan

    As per the Support case , here is the resolution steps if this might also helps you.

    Yes, it is possible to deploy a Redis instance on AKS (Azure Kubernetes Service). You can use a Kubernetes manifest file to define the Redis deployment and service. The manifest file includes the necessary configuration for the Redis instance, such as the image and resource limits. Here is an example of a Kubernetes manifest file that deploys a Redis instance on AKS:

    apiVersion: apps/v1
    kind: Deployment
      name: azure-vote-back
      replicas: 1
          app: azure-vote-back
            app: azure-vote-back
            "": linux
          - name: azure-vote-back
            - name: ALLOW_EMPTY_PASSWORD
              value: "yes"
                cpu: 100m
                memory: 128Mi
                cpu: 250m
                memory: 256Mi
            - containerPort: 6379
              name: redis
    apiVersion: v1
    kind: Service
      name: azure-vote-back
      - port: 6379
        app: azure-vote-back

    You can deploy the Redis instance using the kubectl apply command and specifying the name of the YAML manifest file:

    kubectl apply -f azure-vote.yaml

    This will create the necessary deployments and services for the Redis instance on AKS.

    0 comments No comments