This project sets up a Redis instance using Docker and Docker Compose. It includes a Makefile
for managing the Docker setup, a docker-compose.yml
file for defining the services, a Dockerfile
for building the Redis image, and an example .env
file for environment variables.
- Docker 🐳
- Docker Compose 🛠️
-
Clone the repository:
git clone [email protected]:YourUsername/Redis-docker.git cd Redis-docker
-
Copy the
.env.example
file to.env
and fill in the required environment variables:cp .env.example .env
make build
: Build the Docker image and run the containers. 🚀make up
: Start the containers without rebuilding. 🔄make down
: Stop and remove the containers. 🛑make logs
: View logs from the containers. 📜make ps
: Show running containers. 📋make clean
: Clean up unused Docker resources. 🧹make publish
: Tag and push the Docker image to Docker Hub. 📤make help
: Display available commands. ❓
The docker-compose.yml
file defines a single service:
redis
: The Redis database service. 🗄️
The Dockerfile
builds a custom Redis image with the following stages:
- Final stage: Sets up the Redis environment, and starts Redis. 🐘
The .env
file should contain the following variables:
REDIS_PASSWORD
: The password for the Redis instance. 🔑DOCKER_USERNAME
: Your Docker Hub username. 🧑💻IMAGE_NAME
: The name of the Docker image. 🏷️TAG
: The tag for the Docker image. 🏷️
-
Build and start the containers:
make build
-
Start the containers without rebuilding:
make up
-
Stop and remove the containers:
make down
-
View logs from the containers:
make logs
-
Show running containers:
make ps
-
Clean up unused Docker resources:
make clean
-
Tag and push the Docker image to Docker Hub:
make publish
-
Display available commands:
make help
The Docker image is available on Docker Hub: yourusername/redis-docker
The Docker image is available on GitHub: yourusername/redis-docker
Redis in Docker 🛢️