From dae2828957b6b962109a9f7ad061e9ddd90b8833 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 24 Apr 2013 15:14:10 -0700 Subject: [PATCH 1/3] Moving runtime.Create to builder.Create --- builder.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder.go b/builder.go index 61ea03311c..f22d4864e6 100644 --- a/builder.go +++ b/builder.go @@ -277,6 +277,10 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e fmt.Fprintf(stdout, "===> %s\n", image.ShortId()) break } + config, err := ParseRun([]string{image.Id, "/bin/sh", "-c", tmp[1]}, nil, builder.runtime.capabilities) + if err != nil { + return err + } // Create the container and start it c, err := builder.Create(config) @@ -286,6 +290,9 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e if err := c.Start(); err != nil { return nil, err } + if err := c.Start(); err != nil { + return err + } tmpContainers[c.Id] = struct{}{} // Wait for it to finish From 49b05eb24a3281a8d57791b09f5b82f7dafc87f8 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 2 May 2013 04:12:42 -0700 Subject: [PATCH 2/3] Update docker builder doc --- docs/sources/builder/basics.rst | 38 +++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/sources/builder/basics.rst b/docs/sources/builder/basics.rst index a233515ef2..2282cccf29 100644 --- a/docs/sources/builder/basics.rst +++ b/docs/sources/builder/basics.rst @@ -34,14 +34,39 @@ The `FROM` instruction must be the first one in order for Builder to know from w `FROM` can also be used in order to build multiple images within a single Dockerfile -2.2 RUN +2.2 MAINTAINER +-------------- + ``MAINTAINER `` + +The `MAINTAINER` instruction allow you to set the Author field of the generated images. +This instruction is never automatically reset. + +2.3 RUN ------- ``RUN `` The `RUN` instruction is the main one, it allows you to execute any commands on the `FROM` image and to save the results. You can use as many `RUN` as you want within a Dockerfile, the commands will be executed on the result of the previous command. -2.3 INSERT + +2.4 CMD +------- + ``CMD `` + +The `CMD` instruction sets the command to be executed when running the image. +It is equivalent to do `docker commit -run '{"Cmd": }'` outside the builder. + +.. note:: + Do not confuse `RUN` with `CMD`. `RUN` actually run a command and save the result, `CMD` does not execute anything. + +2.5 EXPOSE +---------- + ``EXPOSE [...]`` + +The `EXPOSE` instruction sets ports to be publicly exposed when running the image. +This is equivalent to do `docker commit -run '{"PortSpecs": ["", ""]}'` outside the builder. + +2.6 INSERT ---------- ``INSERT `` @@ -51,6 +76,7 @@ The `INSERT` instruction will download the file at the given url and place it wi .. note:: The path must include the file name. + 3. Dockerfile Examples ====================== @@ -61,8 +87,9 @@ The `INSERT` instruction will download the file at the given url and place it wi # VERSION 0.0.1 # DOCKER-VERSION 0.2 - from ubuntu - + from ubuntu + maintainer Guillaume J. Charmes "guillaume@dotcloud.com" + # make sure the package repository is up to date run echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list run apt-get update @@ -89,3 +116,6 @@ The `INSERT` instruction will download the file at the given url and place it wi run x11vnc -storepasswd 1234 ~/.vnc/passwd # Autostart firefox (might not be the best way to do it, but it does the trick) run bash -c 'echo "firefox" >> /.bashrc' + + expose 5900 + cmd ["x11vnc", "-forever", "-usepw", "-create"] From 7757be1f452c625d26d1b086384003ab6131e6d4 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Mon, 6 May 2013 17:12:56 -0700 Subject: [PATCH 3/3] Rebase fix --- builder.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/builder.go b/builder.go index f22d4864e6..61ea03311c 100644 --- a/builder.go +++ b/builder.go @@ -277,10 +277,6 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e fmt.Fprintf(stdout, "===> %s\n", image.ShortId()) break } - config, err := ParseRun([]string{image.Id, "/bin/sh", "-c", tmp[1]}, nil, builder.runtime.capabilities) - if err != nil { - return err - } // Create the container and start it c, err := builder.Create(config) @@ -290,9 +286,6 @@ func (builder *Builder) Build(dockerfile io.Reader, stdout io.Writer) (*Image, e if err := c.Start(); err != nil { return nil, err } - if err := c.Start(); err != nil { - return err - } tmpContainers[c.Id] = struct{}{} // Wait for it to finish