Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
29 lines (23 loc) · 700 Bytes
/
Copy pathMakefile
File metadata and controls
29 lines (23 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.PHONY: build redis stop clean
# Docker image name
IMAGE_NAME = my-redis
CONTAINER_NAME = redis-server
# Build the Docker image
build:
docker build -t $(IMAGE_NAME).
# Run Redis container
redis: build
docker run --name $(CONTAINER_NAME) -d -p 6379:6379 $(IMAGE_NAME)
@echo "Redis server is running on port 6379"
@echo "Connect with: redis-cli -h localhost -p 6379"
# Stop the Redis container
stop:
docker stop $(CONTAINER_NAME)||true
docker rm $(CONTAINER_NAME)||true
# Clean up (remove container and image)
clean: stop
docker rmi $(IMAGE_NAME)||true
# Show container status
status:
@echo "Container status:"
@docker ps -a | grep $(CONTAINER_NAME)||echo"Container not found"