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

docker build returns 0 exit code even when build fails #1150

Closed
ricardokirkner opened this Issue Jul 6, 2013 · 9 comments

Comments

Projects
None yet
6 participants
@ricardokirkner

ricardokirkner commented Jul 6, 2013

Running docker build returns a 0 exit code despite the build process failed at some point.

For example, a simple Dockerfile like

--------8<-------
from base
run sh -c "exit 1"
--------8<-------

will cause "docker build - < Dockerfile" to exit with a 0 status. It should be exiting with the status code of the last successful/failed command.

@crosbymichael

This comment has been minimized.

Show comment
Hide comment
@crosbymichael

crosbymichael Jul 8, 2013

Contributor

@creack @shykes

I'm working on this now. Do you think docker build should return a consistent error code for all failed builds or should it return the error code of the failed instruction?

Contributor

crosbymichael commented Jul 8, 2013

@creack @shykes

I'm working on this now. Do you think docker build should return a consistent error code for all failed builds or should it return the error code of the failed instruction?

@shykes

This comment has been minimized.

Show comment
Hide comment
@shykes

shykes Jul 8, 2013

Collaborator

I think the error code of the last instruction would be a nice bonus.

@solomonstre
@getdocker

On Mon, Jul 8, 2013 at 6:20 AM, Michael Crosby notifications@github.com
wrote:

@creack @shykes

I'm working on this now. Do you think docker build should return a consistent error code for all failed builds or should it return the error code of the failed instruction?

Reply to this email directly or view it on GitHub:
#1150 (comment)

Collaborator

shykes commented Jul 8, 2013

I think the error code of the last instruction would be a nice bonus.

@solomonstre
@getdocker

On Mon, Jul 8, 2013 at 6:20 AM, Michael Crosby notifications@github.com
wrote:

@creack @shykes

I'm working on this now. Do you think docker build should return a consistent error code for all failed builds or should it return the error code of the failed instruction?

Reply to this email directly or view it on GitHub:
#1150 (comment)

@creack

This comment has been minimized.

Show comment
Hide comment
@creack

creack Jul 8, 2013

Contributor

@crosbymichael If you are working on it, I think you can take a look at how push/pull is implemented. We should have something similar for build.

Contributor

creack commented Jul 8, 2013

@crosbymichael If you are working on it, I think you can take a look at how push/pull is implemented. We should have something similar for build.

@crosbymichael

This comment has been minimized.

Show comment
Hide comment
@crosbymichael

crosbymichael Jul 8, 2013

Contributor

@creack do you mean the sf.FormatStatus ?

Contributor

crosbymichael commented Jul 8, 2013

@creack do you mean the sf.FormatStatus ?

@vieux

This comment has been minimized.

Show comment
Hide comment
@vieux

vieux Jul 8, 2013

Collaborator

@crosbymichael yes, if you could use the same system it would be great, maybe improve utils.JSONMessage if you need to

Collaborator

vieux commented Jul 8, 2013

@crosbymichael yes, if you could use the same system it would be great, maybe improve utils.JSONMessage if you need to

@crosbymichael

This comment has been minimized.

Show comment
Hide comment
@crosbymichael

crosbymichael Jul 8, 2013

Contributor

I'll look into it. The status output that I currently have uses this struct.

type buildStep struct {
  Step        int
  Cached      bool
  Description string
  ContainerId string
  ImageId     string
  Error       *buildError `json:",omitempty"`
  Complete    bool
  Warning     string
}

type buildError struct {
  Description string
  ExitCode    int
}
Contributor

crosbymichael commented Jul 8, 2013

I'll look into it. The status output that I currently have uses this struct.

type buildStep struct {
  Step        int
  Cached      bool
  Description string
  ContainerId string
  ImageId     string
  Error       *buildError `json:",omitempty"`
  Complete    bool
  Warning     string
}

type buildError struct {
  Description string
  ExitCode    int
}
@shykes

This comment has been minimized.

Show comment
Hide comment
@shykes

shykes Aug 24, 2013

Collaborator

Tentatively scheduling for 0.7.

Collaborator

shykes commented Aug 24, 2013

Tentatively scheduling for 0.7.

@graydon

This comment has been minimized.

Show comment
Hide comment
@graydon

graydon Oct 3, 2013

Contributor

Bump. Just ran into this. (0.6.3)

Contributor

graydon commented Oct 3, 2013

Bump. Just ran into this. (0.6.3)

@creack

This comment has been minimized.

Show comment
Hide comment
@creack

creack Nov 20, 2013

Contributor

Closing in favor of #1875

Contributor

creack commented Nov 20, 2013

Closing in favor of #1875

@creack creack closed this Nov 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment