- Replies:
- 0
- Words:
- 5633

docker pull redis
This command fetches the latest Redis image from Docker Hub. If you want a specific version, append the tag, like redis:7.2
.
docker run --name redis-container -p 6379:6379 -d redis
Let’s break that down:
--name redis-container
gives your container a friendly name.-p 6379:6379
maps Redis’s default port from the container to your host machine.-d
runs the container in the background (detached mode).redis
is the image name we pulled earlier.docker ps
to confirm the container is active.docker exec -it redis-container redis-cli
You’ll get a prompt like this:
127.0.0.1:6379>
Try a test command:
127.0.0.1:6379> PING
You should get a reply:
PONG
Congrats—you’re officially talking to Redis via Docker.
docker-compose.yml
file like this:
version: '3'
services:
redis:
image: redis
container_name: redis-container
ports:
- "6379:6379"
Then run:
docker-compose up -d
This starts Redis in the background, and you can stop it with docker-compose down
.
docker run --name redis-container -p 6379:6379 -v /path/to/redis.conf:/usr/local/etc/redis/redis.conf redis redis-server /usr/local/etc/redis/redis.conf
This command tells Docker to use your custom configuration file inside the container.
docker run --name redis-container -p 6379:6379 -v redis-data:/data -d redis
Docker will store Redis data in a named volume called redis-data
.
I was looking for this, thanks a lot!
easy to understand
Great! Thanks for your explanation!
Thanks for the comment! Feel free to share more thoughts if you have any—this is a space for exchanging ideas and discussing Java.
Great explanation! @Autowired really does make dependency injection in Spring so much simpler. I love how it keeps our code cleaner and more flexible, especially by avoiding manual instantiation and m
Absolutely! autowired helps a lot on spring framework. We don't need creating new code for same services
image quote pre code