fbpx

Redis Docker Compose with a Persistent Volume

Here is a sample Docker Compose file that you can use to set up Redis with a persistent volume using Docker:

				
					version: '3'

services:
  redis:
    image: redis:latest
    volumes:
      - redis-data:/data
    ports:
      - "6379:6379"

volumes:
  redis-data:
    driver: local

				
			

This Docker Compose file defines a single service: Redis. It specifies the Docker image to use for the service and maps the necessary ports to enable communication with the database. It also defines a volume called redis-data to store the data for the Redis database.

To use this Docker Compose file, save it to a file (e.g., docker-compose.yml) and run the following command:

				
					docker-compose up

				
			

This will start the Redis container and bring up the database. The data stored in the Redis database will be persisted in the redis-data volume, so it will be preserved even if the Redis container is stopped or removed.

I hope this helps! Let me know if you have any questions.

Share:

Facebook
Twitter
Pinterest
LinkedIn

Social Media

Most Popular

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

Categories