Skip to content

Adds --name to Redis container in restart example#25553

Merged
dvdksn merged 1 commit into
docker:mainfrom
RScrafted:docs/improve-docker-restart-policy-test-commands
Jul 14, 2026
Merged

Adds --name to Redis container in restart example#25553
dvdksn merged 1 commit into
docker:mainfrom
RScrafted:docs/improve-docker-restart-policy-test-commands

Conversation

@RScrafted

@RScrafted RScrafted commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug in the sequential code examples for Docker restart policies.

The Problem

The current documentation lists the following two steps sequentially:

  1. docker run -d --restart unless-stopped redis
  2. docker update --restart unless-stopped redis

Step 2 assumes the container name is redis. However, because Step 1 does not explicitly define a --name, Docker assigns a randomly generated name, causing Step 2 to fail with the following error:

Error response from daemon: No such container: redis

The Solution

Added the --name redis flag to the initial docker run command so that the subsequent docker update command works seamlessly as written.

docker run -d --name redis --restart unless-stopped redis

Fixes a bug where a subsequent `docker update` command fails because the
container was originally run with a random generated name instead of 'redis'.
@RScrafted RScrafted requested a review from dvdksn as a code owner July 13, 2026 18:44
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit a386cdc
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6a553215a338330008f0ceec
😎 Deploy Preview https://deploy-preview-25553--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the area/engine Issue affects Docker engine/daemon label Jul 13, 2026

@dvdksn dvdksn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@dvdksn dvdksn merged commit 865e7f9 into docker:main Jul 14, 2026
16 checks passed
@RScrafted RScrafted deleted the docs/improve-docker-restart-policy-test-commands branch July 14, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/engine Issue affects Docker engine/daemon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants