mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add doc for the builder
This commit is contained in:
parent
034c7a7a5e
commit
bbb634a980
5 changed files with 117 additions and 1 deletions
docs/sources
91
docs/sources/builder/basics.rst
Normal file
91
docs/sources/builder/basics.rst
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
==============
|
||||||
|
Docker Builder
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. contents:: Table of Contents
|
||||||
|
|
||||||
|
1. Format
|
||||||
|
=========
|
||||||
|
|
||||||
|
The Docker builder format is quite simple:
|
||||||
|
|
||||||
|
``instruction arguments``
|
||||||
|
|
||||||
|
The first instruction must be `FROM`
|
||||||
|
|
||||||
|
All instruction are to be placed in a file named `Dockerfile`
|
||||||
|
|
||||||
|
In order to place comments within a Dockerfile, simply prefix the line with "`#`"
|
||||||
|
|
||||||
|
2. Instructions
|
||||||
|
===============
|
||||||
|
|
||||||
|
Docker builder comes with a set of instructions:
|
||||||
|
|
||||||
|
1. FROM: Set from what image to build
|
||||||
|
2. RUN: Execute a command
|
||||||
|
3. INSERT: Insert a remote file (http) into the image
|
||||||
|
|
||||||
|
2.1 FROM
|
||||||
|
--------
|
||||||
|
``FROM <image>``
|
||||||
|
|
||||||
|
The `FROM` instruction must be the first one in order for Builder to know from where to run commands.
|
||||||
|
|
||||||
|
`FROM` can also be used in order to build multiple images within a single Dockerfile
|
||||||
|
|
||||||
|
2.2 RUN
|
||||||
|
-------
|
||||||
|
``RUN <command>``
|
||||||
|
|
||||||
|
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
|
||||||
|
----------
|
||||||
|
|
||||||
|
``INSERT <file url> <path>``
|
||||||
|
|
||||||
|
The `INSERT` instruction will download the file at the given url and place it within the image at the given path.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The path must include the file name.
|
||||||
|
|
||||||
|
3. Dockerfile Examples
|
||||||
|
======================
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Nginx
|
||||||
|
#
|
||||||
|
# VERSION 0.0.1
|
||||||
|
# DOCKER-VERSION 0.2
|
||||||
|
|
||||||
|
from ubuntu
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
run apt-get install -y inotify-tools nginx apache openssh-server
|
||||||
|
insert https://raw.github.com/creack/docker-vps/master/nginx-wrapper.sh /usr/sbin/nginx-wrapper
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Firefox over VNC
|
||||||
|
#
|
||||||
|
# VERSION 0.3
|
||||||
|
# DOCKER-VERSION 0.2
|
||||||
|
|
||||||
|
from ubuntu
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Install vnc, xvfb in order to create a 'fake' display and firefox
|
||||||
|
run apt-get install -y x11vnc xvfb firefox
|
||||||
|
run mkdir /.vnc
|
||||||
|
# Setup a password
|
||||||
|
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'
|
14
docs/sources/builder/index.rst
Normal file
14
docs/sources/builder/index.rst
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
:title: docker documentation
|
||||||
|
:description: Documentation for docker builder
|
||||||
|
:keywords: docker, builder, dockerfile
|
||||||
|
|
||||||
|
|
||||||
|
Builder
|
||||||
|
=======
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
basics
|
|
@ -27,6 +27,7 @@ Available Commands
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
command/attach
|
command/attach
|
||||||
|
command/build
|
||||||
command/commit
|
command/commit
|
||||||
command/diff
|
command/diff
|
||||||
command/export
|
command/export
|
||||||
|
|
9
docs/sources/commandline/command/build.rst
Normal file
9
docs/sources/commandline/command/build.rst
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
===========================================
|
||||||
|
``build`` -- Build a container from Dockerfile via stdin
|
||||||
|
===========================================
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
Usage: docker build -
|
||||||
|
Example: cat Dockerfile | docker build -
|
||||||
|
Build a new image from the Dockerfile passed via stdin
|
|
@ -17,7 +17,8 @@ This documentation has the following resources:
|
||||||
commandline/index
|
commandline/index
|
||||||
registry/index
|
registry/index
|
||||||
index/index
|
index/index
|
||||||
|
builder/index
|
||||||
faq
|
faq
|
||||||
|
|
||||||
|
|
||||||
.. image:: http://www.docker.io/_static/lego_docker.jpg
|
.. image:: http://www.docker.io/_static/lego_docker.jpg
|
||||||
|
|
Loading…
Add table
Reference in a new issue