docker:create_an_image
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
docker:create_an_image [2016/10/18 09:03] – created peter | docker:create_an_image [2020/05/13 08:39] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Docker - Create an image ====== | ||
- | |||
- | It’s fairly simple to install Debian’s base packages on your current machine and it doesn’t matter if you’re currently not on a Debian host system. There’s a tool called **[[https:// | ||
- | |||
- | You can download it via your package manager. | ||
- | |||
- | <code bash> | ||
- | aptitude install debootstrap | ||
- | </ | ||
- | |||
- | As soon as the utility is available on your system you just need to tell it the suite, target and the mirror so basically, in that order, the name of the Debian version, the directory where to install the packages and the URL from which the packages are downloaded. | ||
- | |||
- | <code bash> | ||
- | mkdir wheezy | ||
- | sudo debootstrap wheezy ./wheezy http:// | ||
- | </ | ||
- | |||
- | This step can take a moment depending on your internet connection. | ||
- | |||
- | Amongst the required suite and target Debian’s bootstrap utility also accepts options from which some are listed below. | ||
- | |||
- | < | ||
- | SYNOPSIS | ||
- | | ||
- | |||
- | OPTIONS | ||
- | | ||
- | Comma separated | ||
- | extract lists. | ||
- | |||
- | | ||
- | Comma separated list of packages which will be removed from download and | ||
- | extract lists. WARNING: you can and probably will exclude essential | ||
- | packages, be careful using this option. | ||
- | |||
- | | ||
- | Name of the bootstrap script variant to use. Currently, the variants | ||
- | supported are minbase, | ||
- | apt; buildd, which installs the build-essential packages into TARGET; | ||
- | and fakechroot, which installs the packages without root privileges. | ||
- | Finally there is variant scratchbox, which is for creating targets for | ||
- | scratchbox usage. The default, with no --variant=X argument, is to create | ||
- | a base Debian installation in TARGET. | ||
- | |||
- | | ||
- | Instead | ||
- | downloaded packages. | ||
- | --unpack-tarball. | ||
- | </ | ||
- | |||
- | Assuming you want to install additional packages such as zsh or git you can do so by specifying them with the **< | ||
- | |||
- | |||
- | ===== Create the tarball ===== | ||
- | |||
- | Docker supports both non-compressed but also compressed images so a .tar, .tar.gz, .tgz, .bzip, .tar.xz or .txz image will be totally fine. Here we create a non-compressed tarball. | ||
- | |||
- | <code bash> | ||
- | sudo tar -C wheezy -cf wheezy.tar . | ||
- | sudo chown you:you wheezy.tar | ||
- | </ | ||
- | |||
- | According to debootstrap’s documentation one should be able to use its option **–make-tarball** to create the tarball during the bootstrap process by executing: | ||
- | |||
- | <code bash> | ||
- | debootstrap --make-tarball=wheezy.tar wheezy ./wheezy http:// | ||
- | </ | ||
- | |||
- | but when doing so the image is some sort of corrupt and incomplete. | ||
- | |||
- | To share your image with the community you could upload the image and make it available for other docker users. | ||
- | |||
docker/create_an_image.1476781417.txt.gz · Last modified: 2020/07/15 09:30 (external edit)