Browse code

Add doc for the builder

Guillaume J. Charmes authored on 2013/05/02 05:37:32
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,91 @@
0
+==============
1
+Docker Builder
2
+==============
3
+
4
+.. contents:: Table of Contents
5
+
6
+1. Format
7
+=========
8
+
9
+The Docker builder format is quite simple:
10
+
11
+    ``instruction arguments``
12
+
13
+The first instruction must be `FROM`
14
+
15
+All instruction are to be placed in a file named `Dockerfile`
16
+
17
+In order to place comments within a Dockerfile, simply prefix the line with "`#`"
18
+
19
+2. Instructions
20
+===============
21
+
22
+Docker builder comes with a set of instructions:
23
+
24
+1. FROM: Set from what image to build
25
+2. RUN: Execute a command
26
+3. INSERT: Insert a remote file (http) into the image
27
+
28
+2.1 FROM
29
+--------
30
+    ``FROM <image>``
31
+
32
+The `FROM` instruction must be the first one in order for Builder to know from where to run commands.
33
+
34
+`FROM` can also be used in order to build multiple images within a single Dockerfile
35
+
36
+2.2 RUN
37
+-------
38
+    ``RUN <command>``
39
+
40
+The `RUN` instruction is the main one, it allows you to execute any commands on the `FROM` image and to save the results.
41
+You can use as many `RUN` as you want within a Dockerfile, the commands will be executed on the result of the previous command.
42
+
43
+2.3 INSERT
44
+----------
45
+
46
+    ``INSERT <file url> <path>``
47
+
48
+The `INSERT` instruction will download the file at the given url and place it within the image at the given path.
49
+
50
+.. note::
51
+    The path must include the file name.
52
+
53
+3. Dockerfile Examples
54
+======================
55
+
56
+::
57
+
58
+    # Nginx
59
+    #
60
+    # VERSION               0.0.1
61
+    # DOCKER-VERSION        0.2
62
+    
63
+    from ubuntu
64
+
65
+    # make sure the package repository is up to date
66
+    run echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
67
+    run apt-get update
68
+    
69
+    run apt-get install -y inotify-tools nginx apache openssh-server
70
+    insert https://raw.github.com/creack/docker-vps/master/nginx-wrapper.sh /usr/sbin/nginx-wrapper
71
+
72
+::
73
+
74
+    # Firefox over VNC
75
+    #
76
+    # VERSION               0.3
77
+    # DOCKER-VERSION        0.2
78
+    
79
+    from ubuntu
80
+    # make sure the package repository is up to date
81
+    run echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
82
+    run apt-get update
83
+    
84
+    # Install vnc, xvfb in order to create a 'fake' display and firefox
85
+    run apt-get install -y x11vnc xvfb firefox
86
+    run mkdir /.vnc
87
+    # Setup a password
88
+    run x11vnc -storepasswd 1234 ~/.vnc/passwd
89
+    # Autostart firefox (might not be the best way to do it, but it does the trick)
90
+    run bash -c 'echo "firefox" >> /.bashrc'
0 91
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+:title: docker documentation
1
+:description: Documentation for docker builder
2
+:keywords: docker, builder, dockerfile
3
+
4
+
5
+Builder
6
+=======
7
+
8
+Contents:
9
+
10
+.. toctree::
11
+  :maxdepth: 2
12
+
13
+  basics
... ...
@@ -27,6 +27,7 @@ Available Commands
27 27
    :maxdepth: 1
28 28
 
29 29
    command/attach
30
+   command/build
30 31
    command/commit
31 32
    command/diff
32 33
    command/export
33 34
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+===========================================
1
+``build`` -- Build a container from Dockerfile via stdin
2
+===========================================
3
+
4
+::
5
+
6
+    Usage: docker build -
7
+    Example: cat Dockerfile | docker build -
8
+    Build a new image from the Dockerfile passed via stdin
... ...
@@ -15,7 +15,8 @@ This documentation has the following resources:
15 15
    examples/index
16 16
    contributing/index
17 17
    commandline/index
18
+   builder/index
18 19
    faq
19 20
 
20 21
 
21
-.. image:: http://www.docker.io/_static/lego_docker.jpg
22 22
\ No newline at end of file
23
+.. image:: http://www.docker.io/_static/lego_docker.jpg