Differences between revisions 3 and 22 (spanning 19 versions)
Revision 3 as of 2014-03-06 12:28:25
Size: 1218
Comment:
Revision 22 as of 2015-05-14 13:58:31
Size: 3634
Editor: jmtd
Comment: re-order options (move deprecated to the bottom)
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
'''The following is work in progress WITHOUT ANY WARANTY''' [[https://index.docker.io/_/debian/|Docker.com provide Debian images]] they describe as "semi-official". They are modified from stock Debian (see [[http://joeyh.name/blog/entry/docker_run_debian/|Joey H's blog post]] for some of the differences) and there is no secure way of obtaining the images or proving they have not been tampered with.
Line 5: Line 5:
The `docker.io` package ships the `/usr/share/docker.io/contrib/mkimage-debootstrap.sh` script which may be used to create a Docker image for Debian (or Ubuntu) using `debootstrap`, and with or without further tweaks. You can create your own Debian Docker images using the methods described below.
Line 7: Line 7:
''Note that due to bug #740855 `/usr/share/docker.io/contrib/mkimage-debootstrap.sh` needs to be patched at the moment.'' '''The following is work in progress WITHOUT ANY WARRANTY'''

<<TableOfContents()>>

== Using (upstream provided "contrib" script) mkimage.sh ==

The `docker.io` package ships the `/usr/share/docker.io/contrib/mkimage.sh` script which may be used, alongside the companion script `/usr/share/docker.io/contrib/mkimage/debootstrap` to create a Docker image for Debian (or Ubuntu) using `debootstrap`, and with or without further tweaks.

You may create an image for the `stable` suite (using the `minbase` debootstrap variant) with :
{{{
sudo .../mkimage.sh -t $USER/minbase debootstrap --variant=minbase stable
}}}

The image may then be used with :
{{{
sudo docker.io run -i $USER/minbase echo "hello world"
}}}

Contrary to the former mkimage-debootstrap.sh (now deprecated, see below), contrib/mkimage/debootstrap does not need the mandatory `variant` parameter, and can invoke debootstrap without a specific variant, using its default settings.

== Manual method ==

To build pristine debian images, without cloud/docker-specific, customisations, you can use the scripts at <https://github.com/jmtd/debian-docker>. These use {{{debootstrap}}} to prepare a basic filesystem and add them into a docker image. Suggestions for improvements are very welcome.

Images built from these scripts are pushed to the Docker Registry as {{{jmtd/debian:wheezy}}}, {{{jmtd/debian:jessie}}} etc., but there is presently no image verification in place (so no way to cryptographically prove the provenance of the images).

See also <http://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker#a2>.

== Using mkimage-debootstrap.sh (now flagged as deprecated by upstream) ==

The `docker.io` package still ships the, now deprecated, `/usr/share/docker.io/contrib/mkimage-debootstrap.sh` script which may be used to create a Docker image for Debian (or Ubuntu) using `debootstrap`, and with or without further tweaks.
Line 19: Line 49:
As an alternative to upstream's choices, you may modify the script so that it does not use the minbase variant by default (see for instance [[https://raw.github.com/olberger/docker/debian/contrib/mkimage-debootstrap.sh|obergix's version]] and adjust to your needs), or use the newer mkimage.sh (see above).
Line 20: Line 51:
See also http://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker#a2 if you want to use a manual debootstrap install (without the upstream's contrib script's tweaks). == Using the newly built image to create a test container ==
Line 22: Line 53:

A dockerfile may also directly the following directive :
A dockerfile may then refer to your image using the following directive :
Line 25: Line 55:
FROM debian:sid FROM YOURUSER/minbase:stable
Line 28: Line 58:
== References == You may test it with :
{{{
echo "FROM $USER/minbase:stable" | docker.io build -t $USER/test:stable -
}}}

== Resources ==
Line 30: Line 65:
 * Nickoloff, Jeff, Docker in Action (http://www.manning.com/nickoloff/), Manning Publications, 2014, ISBN 978-1-6334-3023-5

This page attempts to document how to create a Debian image for Docker.

Docker.com provide Debian images they describe as "semi-official". They are modified from stock Debian (see Joey H's blog post for some of the differences) and there is no secure way of obtaining the images or proving they have not been tampered with.

You can create your own Debian Docker images using the methods described below.

The following is work in progress WITHOUT ANY WARRANTY

Using (upstream provided "contrib" script) mkimage.sh

The docker.io package ships the /usr/share/docker.io/contrib/mkimage.sh script which may be used, alongside the companion script /usr/share/docker.io/contrib/mkimage/debootstrap to create a Docker image for Debian (or Ubuntu) using debootstrap, and with or without further tweaks.

You may create an image for the stable suite (using the minbase debootstrap variant) with :

sudo .../mkimage.sh -t $USER/minbase debootstrap --variant=minbase stable

The image may then be used with :

sudo docker.io run -i $USER/minbase echo "hello world"

Contrary to the former mkimage-debootstrap.sh (now deprecated, see below), contrib/mkimage/debootstrap does not need the mandatory variant parameter, and can invoke debootstrap without a specific variant, using its default settings.

Manual method

To build pristine debian images, without cloud/docker-specific, customisations, you can use the scripts at <https://github.com/jmtd/debian-docker>. These use debootstrap to prepare a basic filesystem and add them into a docker image. Suggestions for improvements are very welcome.

Images built from these scripts are pushed to the Docker Registry as jmtd/debian:wheezy, jmtd/debian:jessie etc., but there is presently no image verification in place (so no way to cryptographically prove the provenance of the images).

See also <http://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker#a2>.

Using mkimage-debootstrap.sh (now flagged as deprecated by upstream)

The docker.io package still ships the, now deprecated, /usr/share/docker.io/contrib/mkimage-debootstrap.sh script which may be used to create a Docker image for Debian (or Ubuntu) using debootstrap, and with or without further tweaks.

You may create an image for the stable suite (using the minbase debootstrap variant) with :

.../mkimage-debootstrap.sh $USER/minbase stable

The image may then be used with :

sudo docker.io run -i $USER/minbase:stable echo "hello world"

As an alternative to upstream's choices, you may modify the script so that it does not use the minbase variant by default (see for instance obergix's version and adjust to your needs), or use the newer mkimage.sh (see above).

Using the newly built image to create a test container

A dockerfile may then refer to your image using the following directive :

FROM YOURUSER/minbase:stable

You may test it with :

echo "FROM $USER/minbase:stable" | docker.io build -t $USER/test:stable -

Resources