Bug 1331575

Summary: docker run invalid command, on invalid image: inconsistent diagnostics, exit code
Product: Red Hat Enterprise Linux 7 Reporter: Ed Santiago <santiago>
Component: docker-latestAssignee: smahajan <smahajan>
Status: CLOSED CURRENTRELEASE QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: cevich, dwalsh
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-14 15:31:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ed Santiago 2016-04-28 20:39:59 UTC
Given this context:

    # IMG=https://github.com/autotest/autotest-docker/archive/0.7.6.tar.gz
    # docker import $IMG foo

The following command yields inconsistent error messages and exit codes:

    # docker run foo no such command;echo $?

Most of the time, it produces:

    exec: "no": executable file not found in $PATH
    docker: Error response from daemon: Cannot start container <sha>: [9] System error: invalid character ',' looking for beginning of value.
    125        <--- 125 = error in docker daemon itself

Once in a while (~1 in 5) it produces what looks like a sane result:

    exec: "no": executable file not found in $PATH
    docker: Error response from daemon: Container command not found or does not exist..
    127        <--- 127 = command not found (i.e. expected exit status)

And even more rarely (~1 in 8):

    exec: "no": executable file not found in $PATH
    docker: Error response from daemon: Cannot start container <sha>: [9] System error: json: cannot unmarshal string into Go value of type libcontainer.genericError.
    125        <--- docker daemon again

So, yeah, I know: "Docker, Docker, it hurts when I do this." But it would be nice if this produced a consistent 127.

    # rpm -qa|grep docker|sort
    docker-1.9.1-38.el7.x86_64
    docker-common-1.9.1-38.el7.x86_64
    docker-forward-journald-1.9.1-38.el7.x86_64
    docker-latest-1.10.3-19.el7.x86_64
    docker-rhel-push-plugin-1.10.3-19.el7.x86_64
    docker-selinux-1.9.1-38.el7.x86_64
    docker-utils-1.9.1-28.el7.x86_64

Comment 2 smahajan@redhat.com 2016-09-28 14:39:42 UTC
Ed, 

Do you think this is a duplicate of #1364238.
https://bugzilla.redhat.com/show_bug.cgi?id=1364238

Shishir

Comment 3 Ed Santiago 2016-09-28 14:48:32 UTC
I think it's unlikely. Bug 1364238 is specifically about command-line option parsing (--foo, --bar) and is closely tied to the cobra code restructuring. This one is a change only in `docker run` and, in my totally uneducated WAG, is probably in unrelated code. But I can't be sure without a deep dive.

Comment 4 Daniel Walsh 2016-10-18 14:23:46 UTC
Shishir any update on this?

Comment 5 Daniel Walsh 2017-06-14 15:31:26 UTC
We can not reproduce this.