How to start redis in docker


 description

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

 command

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

 parameter

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

 result

1cb125856f1c1dcbd61b6665a26bd1b51b358197f2229b20be63ab95658bb2c2
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.