Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

For the official redis image, pass --requirepass to redis-server after the image name:

export REDIS_PASSWORD='replace-with-a-long-random-password'

docker run -d 
  --name redis 
  -p 127.0.0.1:6379:6379 
  redis:8 
  redis-server --requirepass "$REDIS_PASSWORD"

Verify the password with REDISCLI_AUTH, then add a named volume and append-only persistence if the data must survive container recreation. Redis Stack uses a different, documented REDIS_ARGS pattern, covered below.

Prerequisites and image choice

  • Docker is installed and running.
  • Host port 6379 is available.
  • Use redis:<version> for the official Redis Open Source image. Pin a version for repeatable deployments rather than relying on the mutable latest tag.
  • Use redis/redis-stack:<version> or redis/redis-stack:latest when you need Redis Stack modules (and, in the full Stack image, Redis Insight). Its configuration conventions differ.

You do not need a locally installed redis-cli; the official image includes one, so you can run it with docker exec. Redis documents Docker installation and configuration at redis.io.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start the official Redis image with a password

docker run -d 
  --name redis 
  -p 127.0.0.1:6379:6379 
  redis:8 
  redis-server --requirepass 'replace-with-a-long-random-password'

Everything after redis:8 is the container command and its arguments. The image entrypoint ultimately starts redis-server; explicitly writing it makes the intended configuration clear. --requirepass enables Redis’s compatibility authentication method. -d detaches, --name redis gives the container a stable name, and binding to 127.0.0.1 prevents other host interfaces from accepting connections. See the official image entrypoint.

#1 Best Overall
Sandisk 2TB Extreme Portable SSD, Up to 1050MB/s, USB-C, USB 3.2 Gen 2, IP65 Water and Dust Resistance, Updated Firmware, External Solid State Drive, SDSSDE61-2T00-G25
  • Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
  • Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
  • Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
  • Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
  • Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C

Recommended development command: persistence and restart

export REDIS_PASSWORD='replace-with-a-long-random-password'

docker run -d 
  --name redis 
  --restart unless-stopped 
  -p 127.0.0.1:6379:6379 
  -v redis-data:/data 
  redis:8 
  redis-server 
    --requirepass "$REDIS_PASSWORD" 
    --appendonly yes

The named volume keeps files outside the container. --appendonly yes tells Redis to maintain an append-only file, so a volume alone is not a substitute for enabling Redis persistence. --restart unless-stopped is optional and makes sense for a local service that should return after Docker restarts; Docker documents restart policies in its docker run reference.

Verify authentication

First check that the container is running and inspect startup output:

docker ps
docker logs redis

An unauthenticated request should fail:

docker exec redis redis-cli PING
(error) NOAUTH Authentication required.

Authenticate without placing the password in the redis-cli -a argument:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
  • Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
  • Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
  • Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
  • Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
  • From Sandisk, a brand professional photographers trust to take on assignments.
docker exec 
  -e REDISCLI_AUTH="$REDIS_PASSWORD" 
  redis 
  redis-cli PING
PONG

Redis documents REDISCLI_AUTH as an alternative to -a in its CLI documentation. Test a write and read:

docker exec -e REDISCLI_AUTH="$REDIS_PASSWORD" redis redis-cli SET example "hello"
docker exec -e REDISCLI_AUTH="$REDIS_PASSWORD" redis redis-cli GET example
OK
"hello"

Connect from the host

With a locally installed client:

REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379 PING

For ACL-style client configuration, Redis CLI also supports an explicit user:

redis-cli -h 127.0.0.1 -p 6379 --user default -a "$REDIS_PASSWORD" PING

Prefer a client library’s separate username and password fields where available. If you embed credentials in a URI such as redis://default:[email protected]:6379/0, URL-encode characters such as @, :, /, ?, and #.

Rank #3
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Connect from another Docker container

docker network create app-net

docker run -d 
  --name redis 
  --network app-net 
  -v redis-data:/data 
  redis:8 
  redis-server --requirepass "$REDIS_PASSWORD"

Configure the application with host redis, port 6379, and the same password. Do not use localhost: inside the application container, it refers to that container itself, not the Redis container. A generic URI is redis://default:<password>@redis:6379/0, with the password URL-encoded when necessary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Redis Stack variation

REDIS_ARGS is documented for the Redis Stack image, not as a universal setting for redis:<version>:

docker run -d 
  --name redis-stack 
  -p 127.0.0.1:6379:6379 
  -p 127.0.0.1:8001:8001 
  -e REDIS_ARGS="--requirepass $REDIS_PASSWORD" 
  redis/redis-stack:latest

If REDIS_ARGS appears to do nothing, check which image you started. For the official image, use redis-server --requirepass ... after the image name. See the Redis Stack Docker instructions.

Rank #4
Sale
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
  • NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
  • IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
  • POCKET-SIZED – fits easily in pockets and small bags.
  • SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
  • 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.

Pass the password through an environment file

An environment file can keep the literal value out of the command line, but it does not make the secret invisible to Docker:

printf "REDIS_PASSWORD=%sn" "$REDIS_PASSWORD" > redis.env
chmod 600 redis.env

docker run -d 
  --name redis 
  --env-file ./redis.env 
  -p 127.0.0.1:6379:6379 
  redis:8 
  sh -c 'exec redis-server --requirepass "$REDIS_PASSWORD"'

Here the shell inside the container expands the variable populated by --env-file. Alternatively, host-side "$REDIS_PASSWORD" expansion requires that variable to already be exported in the invoking shell; --env-file does not export it into that host shell. Docker notes that environment values are stored as plain text in container configuration and can be inspected through the Docker API. Do not commit redis.env.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a mounted configuration file

# redis.conf
requirepass replace-with-a-long-random-password
appendonly yes
docker run -d 
  --name redis 
  -p 127.0.0.1:6379:6379 
  -v "$PWD/redis.conf:/usr/local/etc/redis/redis.conf:ro" 
  -v redis-data:/data 
  redis:8 
  redis-server /usr/local/etc/redis/redis.conf

Redis documents this configuration-file mounting pattern. Protect the file permissions and keep it out of source control. requirepass stores the password in clear text in the file; it is convenient, but not a secret-management system. See Redis’s security guidance.

Best Value
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

ACLs for production-style access control

requirepass authenticates the default user and is the simplest compatibility option. Redis 6 and later support ACLs, which provide named users and permissions. A minimal ACL file might be:

user default off
user app on >replace-with-a-long-random-password ~* +@all
appendonly yes

Mount and load it explicitly:

docker run -d 
  --name redis 
  -p 127.0.0.1:6379:6379 
  -v "$PWD/users.acl:/usr/local/etc/redis/users.acl:ro" 
  -v redis-data:/data 
  redis:8 
  redis-server /usr/local/etc/redis/users.acl 
    --aclfile /usr/local/etc/redis/users.acl

The example grants all commands and keys for simplicity; production users should receive only the commands and key patterns they need. ACL syntax, file ownership, and the default-user transition require care. Redis’s ACL documentation covers ACL SETUSER and external ACL files. A safer rollout is to create a named user, persist the ACL, update clients, then disable or restrict the default user.

Security limitations

  • Authentication is not encryption. requirepass does not provide TLS.
  • Keep development Redis local. Use -p 127.0.0.1:6379:6379, not an unrestricted -p 6379:6379.
  • Use private networks in deployments. Authentication does not replace firewalling, network isolation, patching, TLS, or least privilege.
  • Expect metadata exposure. A command-line password can appear in docker inspect, process inspection, shell history, logs, or deployment tooling. Environment variables are also visible in container configuration.
  • Use a long random password and a secret manager or Docker secrets where your orchestration environment supports them.

Troubleshooting and recovery

NOAUTH or WRONGPASS

Confirm the client is reaching the intended container, the password has no accidental shell expansion, and quotes are correct. Inspect docker inspect redis and docker logs redis. URI clients require URL-encoding for reserved characters.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The container exits immediately

Run docker logs redis. Common causes include invalid Redis arguments, a missing or unreadable mounted configuration, incorrect host-file permissions, a name collision, or a port already in use.

Changing the password

Editing the original command does not change an existing container. Recreate it:

docker rm -f redis

Then run the command with the new password. Retain redis-data if the data matters; do not run docker volume rm redis-data unless deletion is intentional. A live administrator can use CONFIG SET requirepass, but that requires coordinated client updates and careful persistence handling.

Quick Recap

Bestseller No. 2
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
Sandisk 1TB Portable SSD, Up to 800MB/s Read Speeds, Black (Old Model)
From Sandisk, a brand professional photographers trust to take on assignments.
$165.70
SaleBestseller No. 3
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
SaleBestseller No. 4
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
Sandisk 1TB Extreme Portable SSD, Up to 2000MB/s Transfer Speeds-New Model
IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.; POCKET-SIZED – fits easily in pockets and small bags.
$253.00
Bestseller No. 5
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$208.99

Practical checklist

  1. Pin an explicit Redis image version.
  2. Generate a long random password and quote it in the shell.
  3. Bind port 6379 to 127.0.0.1 for local use.
  4. Use REDISCLI_AUTH to test an authenticated PONG.
  5. Add a named volume and configure AOF when data must persist.
  6. Use the container name, not localhost, from another container.
  7. Use REDIS_ARGS only with the Redis Stack image where it is documented.
  8. For multiple applications or production, plan ACLs, TLS, network controls, backups, and proper secret management.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.