Browse Source

Builder counts from 1

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 10 years ago
parent
commit
17d6c6c7e5

+ 1 - 1
builder/evaluator.go

@@ -293,7 +293,7 @@ func (b *builder) dispatch(stepN int, ast *parser.Node) error {
 	original := ast.Original
 	original := ast.Original
 	flags := ast.Flags
 	flags := ast.Flags
 	strs := []string{}
 	strs := []string{}
-	msg := fmt.Sprintf("Step %d : %s", stepN, strings.ToUpper(cmd))
+	msg := fmt.Sprintf("Step %d : %s", stepN+1, strings.ToUpper(cmd))
 
 
 	if len(ast.Flags) > 0 {
 	if len(ast.Flags) > 0 {
 		msg += " " + strings.Join(ast.Flags, " ")
 		msg += " " + strings.Join(ast.Flags, " ")

+ 6 - 6
docs/reference/commandline/build.md

@@ -110,9 +110,9 @@ There should be informational output of the reason for failure output to
     $ docker build -t fail .
     $ docker build -t fail .
     Sending build context to Docker daemon 2.048 kB
     Sending build context to Docker daemon 2.048 kB
     Sending build context to Docker daemon
     Sending build context to Docker daemon
-    Step 0 : FROM busybox
+    Step 1 : FROM busybox
      ---> 4986bf8c1536
      ---> 4986bf8c1536
-    Step 1 : RUN exit 13
+    Step 2 : RUN exit 13
      ---> Running in e26670ec7a0a
      ---> Running in e26670ec7a0a
     INFO[0000] The command [/bin/sh -c exit 13] returned a non-zero code: 13
     INFO[0000] The command [/bin/sh -c exit 13] returned a non-zero code: 13
     $ echo $?
     $ echo $?
@@ -167,9 +167,9 @@ you must use `--rm=false`. This does not affect the build cache.
     $ docker build .
     $ docker build .
     Uploading context 18.829 MB
     Uploading context 18.829 MB
     Uploading context
     Uploading context
-    Step 0 : FROM busybox
+    Step 1 : FROM busybox
      ---> 769b9341d937
      ---> 769b9341d937
-    Step 1 : CMD echo Hello world
+    Step 2 : CMD echo Hello world
      ---> Using cache
      ---> Using cache
      ---> 99cc1ad10469
      ---> 99cc1ad10469
     Successfully built 99cc1ad10469
     Successfully built 99cc1ad10469
@@ -177,9 +177,9 @@ you must use `--rm=false`. This does not affect the build cache.
     $ docker build .
     $ docker build .
     Uploading context  6.76 MB
     Uploading context  6.76 MB
     Uploading context
     Uploading context
-    Step 0 : FROM busybox
+    Step 1 : FROM busybox
      ---> 769b9341d937
      ---> 769b9341d937
-    Step 1 : CMD echo Hello world
+    Step 2 : CMD echo Hello world
      ---> Using cache
      ---> Using cache
      ---> 99cc1ad10469
      ---> 99cc1ad10469
     Successfully built 99cc1ad10469
     Successfully built 99cc1ad10469

+ 1 - 1
docs/security/trust/trust_sandbox.md

@@ -120,7 +120,7 @@ So, you'll need an entry for both the servers in your local `/etc/hosts` file.
 
 
         $ docker build -t notarysandbox .
         $ docker build -t notarysandbox .
         Sending build context to Docker daemon 2.048 kB
         Sending build context to Docker daemon 2.048 kB
-        Step 0 : FROM debian:jessie
+        Step 1 : FROM debian:jessie
          ...
          ...
          Successfully built 5683f17e9d72
          Successfully built 5683f17e9d72
      
      

+ 4 - 4
docs/userguide/dockerimages.md

@@ -293,12 +293,12 @@ Now let's take our `Dockerfile` and use the `docker build` command to build an i
     $ docker build -t ouruser/sinatra:v2 .
     $ docker build -t ouruser/sinatra:v2 .
     Sending build context to Docker daemon 2.048 kB
     Sending build context to Docker daemon 2.048 kB
     Sending build context to Docker daemon 
     Sending build context to Docker daemon 
-    Step 0 : FROM ubuntu:14.04
+    Step 1 : FROM ubuntu:14.04
      ---> e54ca5efa2e9
      ---> e54ca5efa2e9
-    Step 1 : MAINTAINER Kate Smith <ksmith@example.com>
+    Step 2 : MAINTAINER Kate Smith <ksmith@example.com>
      ---> Using cache
      ---> Using cache
      ---> 851baf55332b
      ---> 851baf55332b
-    Step 2 : RUN apt-get update && apt-get install -y ruby ruby-dev
+    Step 3 : RUN apt-get update && apt-get install -y ruby ruby-dev
      ---> Running in 3a2558904e9b
      ---> Running in 3a2558904e9b
     Selecting previously unselected package libasan0:amd64.
     Selecting previously unselected package libasan0:amd64.
     (Reading database ... 11518 files and directories currently installed.)
     (Reading database ... 11518 files and directories currently installed.)
@@ -433,7 +433,7 @@ Now let's take our `Dockerfile` and use the `docker build` command to build an i
     Running hooks in /etc/ca-certificates/update.d....done.
     Running hooks in /etc/ca-certificates/update.d....done.
      ---> c55c31703134
      ---> c55c31703134
     Removing intermediate container 3a2558904e9b
     Removing intermediate container 3a2558904e9b
-    Step 3 : RUN gem install sinatra
+    Step 4 : RUN gem install sinatra
      ---> Running in 6b81cb6313e5
      ---> Running in 6b81cb6313e5
     unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
     unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
     unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping
     unable to convert "\xC3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to US-ASCII for README.rdoc, skipping

+ 18 - 1
integration-cli/docker_cli_build_test.go

@@ -5316,7 +5316,24 @@ func (s *DockerSuite) TestBuildNoDupOutput(c *check.C) {
 		c.Fatalf("Build should have worked: %q", err)
 		c.Fatalf("Build should have worked: %q", err)
 	}
 	}
 
 
-	exp := "\nStep 1 : RUN env\n"
+	exp := "\nStep 2 : RUN env\n"
+	if !strings.Contains(out, exp) {
+		c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
+	}
+}
+
+// GH15826
+func (s *DockerSuite) TestBuildStartsFromOne(c *check.C) {
+	// Explicit check to ensure that build starts from step 1 rather than 0
+	name := "testbuildstartsfromone"
+
+	_, out, err := buildImageWithOut(name, `
+  FROM busybox`, false)
+	if err != nil {
+		c.Fatalf("Build should have worked: %q", err)
+	}
+
+	exp := "\nStep 1 : FROM busybox\n"
 	if !strings.Contains(out, exp) {
 	if !strings.Contains(out, exp) {
 		c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
 		c.Fatalf("Bad output\nGot:%s\n\nExpected to contain:%s\n", out, exp)
 	}
 	}