RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1098280 - Docker help does not print to stdout
Summary: Docker help does not print to stdout
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-15 15:49 UTC by J.C. Molet
Modified: 2019-03-06 01:09 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1121209 (view as bug list)
Environment:
Last Closed: 2015-03-18 13:21:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description J.C. Molet 2014-05-15 15:49:58 UTC
Description of problem:
The docker help command does not print to stdout, instead it prints to stderr.  This goes against pretty much every other command that has a help function.

Version-Release number of selected component (if applicable):
Client version: 0.11.1
Client API version: 1.11
Go version (client): go1.2.1
Git commit (client): fb99f99/0.11.1
Server version: 0.11.1
Server API version: 1.11
Git commit (server): fb99f99/0.11.1
Go version (server): go1.2.1

How reproducible:
always

Steps to Reproduce:
1. run "docker help"
or
1. run "docker help <command>"
or
1. run "docker --help"
or
1. run "docker <command> --help"
or
1. run a command incorrectly, ex: "docker attach"

Actual results:
Using my favorite program that reads from stdout, grep, you can illustrate the problem here:

------------------------------------
 ❯ docker help attach | grep proxy

Usage: docker attach [OPTIONS] CONTAINER

Attach to a running container

  --no-stdin=false    Do not attach stdin
  --sig-proxy=true    Proxify all received signal to the process (even in non-tty mode)
------------------------------------

the only way this works is by doing:

------------------------------------
 ❯ docker help attach 2>&1 | grep proxy
  --sig-proxy=true    Proxify all received signal to the process (even in non-tty mode)
------------------------------------

Typically usage statements are not considered things that should be printed to errors, only error messages are considered errors.

------------------------------------
 ❯ docker attach
                                   <<<<<< no error message to stderr
                                   -------usage below should be stdout
Usage: docker attach [OPTIONS] CONTAINER

Attach to a running container

  --no-stdin=false: Do not attach stdin
  --sig-proxy=true: Proxify all received signal to the process (even in non-tty mode)
------------------------------------




Expected results:
Usage statements would be printed to stdout always so things like this would work:

------------------------------------
 ❯ docker help attach | grep proxy
  --sig-proxy=true    Proxify all received signal to the process (even in non-tty mode)
------------------------------------

In addition, misuse of commands should print out an error to stderr, and [optionally] the usage to stdout:

------------------------------------
 ❯ docker attach
Error: attach requires a container   <<<< printed to stderr
Usage: docker attach [OPTIONS] CONTAINER   <<< printed to stdout

Attach to a running container

  --no-stdin=false    Do not attach stdin
  --sig-proxy=true    Proxify all received signal to the process (even in non-tty mode)


Additional info:
Needed
 - Help and usage statements printed to stdout
 - Error messages for incorrect invocations of commands printed to stderr
This applies to all docker subcommands.

Comment 1 RHEL Program Management 2014-05-27 05:47:13 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 2 Daniel Walsh 2014-05-27 13:45:00 UTC
Put out a pull request to fix this.

https://github.com/dotcloud/docker/pull/6052

Comment 3 Daniel Walsh 2014-07-15 17:09:07 UTC
Fixed in docker-1.0.0-10.el7.x86_64

Comment 4 Chris Evich 2014-07-18 15:03:31 UTC
The first part of this bug has been fixed (intentional help output goes to stdout).  However second part has not been addressed, incorrect usage is still going to stderr:

    [root@docker docker]# docker help attach | grep proxy
      --sig-proxy=true    Proxify received signals to the process (even in non-tty mode). SIGCHLD is not proxied

    [root@docker docker]# docker attach --asdf | grep proxy
    flag provided but not defined: --asdf

    Usage: docker attach [OPTIONS] CONTAINER

    Attach to a running container

      --help=false        Print usage
      --no-stdin=false    Do not attach stdin
      --sig-proxy=true    Proxify received signals to the process (even in non-tty mode). SIGCHLD is not proxied

docker-1.0.0-10.el7.x86_64
Client version: 1.0.0
Client API version: 1.12
Go version (client): go1.2.2
Git commit (client): 20fdb42/1.0.0
Server version: 1.0.0
Server API version: 1.12
Go version (server): go1.2.2
Git commit (server): 20fdb42/1.0.0

Comment 5 Daniel Walsh 2014-07-18 15:05:41 UTC
That is the way I coded the patch, if the user asks for help it goes to stdout.  IF he gets an error it goes to stderr.

Comment 6 Chris Evich 2014-07-18 15:11:23 UTC
Oh okay, I think I see where there may have been confuxtion.  OP was finding that just the error message part should go to stderr, and the "usage" message should go to stdout.  What he meant by "optional" is, the usage-printing itself is optional, not that it should go to stdout or stderr.  Maynbe it would be easier if I opened a separate bug for that, then we can mark this one as verified.  Sound good?

Comment 7 Daniel Walsh 2014-07-18 15:55:25 UTC
Yes.

Comment 8 Chris Evich 2014-07-18 16:01:14 UTC
Sure thing, np, thanks for quick reply.

Comment 9 Chris Evich 2014-07-18 16:07:14 UTC
Second part of problem moved over to Bug 1121209.  Marking this one verified.  Thanks :D

Comment 11 Daniel Walsh 2014-09-12 18:25:04 UTC
Fixed in docker-1.2


Note You need to log in before you can comment on or make changes to this bug.