Deploy Redis on Ubuntu with Docker — the ultra-fast in-memory database used for caching, session storage, queues, and pub/sub messaging. Auto-generates a secure password.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/databases/redis/redis-ubuntu.sh
chmod +x redis-ubuntu.sh
sudo bash redis-ubuntu.sh
The script installs Docker if needed, generates a secure random password, and starts Redis with authentication enabled.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/databases/redis/redis-ubuntu.sh
chmod +x redis-ubuntu.sh
sudo bash redis-ubuntu.sh
At the end of the script, your auto-generated Redis password is displayed. Save it now — you'll need it to connect.
redis-cli -h <server-ip> -p 6379 -a <generated-password>
Once connected, run a quick test:
PING
# Expected response: PONG
SET mykey "hello"
GET mykey
# Expected response: "hello"
| Port | Purpose |
|---|---|
| 6379 | Redis |