How to start redis in docker


Start redis container in docker, configure password and start automatically, suitable for production environment


docker run -d --name redis -p 6379:6379  \
-v /etc/localtime:/etc/localtime:ro \
--restart=always \
redis --requirepass "dZpHmGV24yIPRakS" --appendonly yes


docker :  is an open source application container engine that allows developers to package their applications and dependencies into a portable image
run :  run the command in the new container
-d, --detach :  run the container in the background and print the container ID
--name :  assign a name to the container
-p, --publish :  publish the container's port to the host
-v, --volume :  bind mount a volume
--restart :  Restart policy to apply when the container exits (default "no")
--requirepass :  redis connection password


Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.