Skip to content

Documentation on Container networks is inconsistent with itself #22317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
BenLyonsGMSL opened this issue Mar 26, 2025 · 2 comments
Closed
1 task done

Documentation on Container networks is inconsistent with itself #22317

BenLyonsGMSL opened this issue Mar 26, 2025 · 2 comments
Labels
status/triage Needs triage

Comments

@BenLyonsGMSL
Copy link

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

In https://docs.docker.com/engine/network/#container-networks, it says:

The following flags aren't supported for containers using the container: networking mode:

  • ...
  • --hostname
  • ...

However, it then follows with an example:

$ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1

It appears to me that this container is using the container: networking mode and using the --hostname flag (via -h). However, according to the documentation, this is unsupported.

Location

https://docs.docker.com/engine/network/#container-networks

Suggestion

Either --hostname needs to be removed from the list of unsupported flags for the container: networking mode, or the example needs to be corrected. I don't know which is correct.

@BenLyonsGMSL BenLyonsGMSL added the status/triage Needs triage label Mar 26, 2025
@thaJeztah
Copy link
Member

Thanks for reporting; the example is correct, but can be a bit confusing.

The -h 127.0.0.1 in this case is an argument for the example/redis-cli container, so it's passed as argument to the redis-cli's main process.

Basically the order of flags and arguments is;

docker run [docker run options (flags)] <image name> [command and args for the container]

@BenLyonsGMSL
Copy link
Author

Apologies for my misunderstanding, and thank you for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage Needs triage
Projects
None yet
Development

No branches or pull requests

2 participants