User Tools

Site Tools


docker:create_an_image

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
docker:create_an_image [2020/04/15 18:54] – created peterdocker: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://wiki.debian.org/Debootstrap|debootstrap]]** which does all the work for you. 
- 
-You can download it via your package manager. 
- 
-<code bash> 
-sudo apt install debootstrap 
-</code> 
- 
-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. 
- 
-Essentially the mirror is optional but we’ll specify it anyway here. 
- 
-<code bash> 
-mkdir wheezy 
-sudo debootstrap wheezy ./wheezy http://http.debian.net/debian/ 
-</code> 
- 
-This step can take a moment depending on your internet connection. 
- 
-You may have noticed that debootstrap requires root privileges to create a file system that belongs root. 
- 
-Amongst the required suite and target Debian’s bootstrap utility also accepts options from which some are listed below. 
- 
-<code bash> 
-SYNOPSIS 
-     debootstrap [OPTION...]  SUITE TARGET [MIRROR [SCRIPT]] 
- 
-OPTIONS 
-     --include=alpha,beta 
-            Comma  separated  list  of  packages  which will be added to download and 
-            extract lists. 
- 
-     --exclude=alpha,beta 
-            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. 
- 
-     --variant=minbase|buildd|fakechroot|scratchbox 
-            Name of the bootstrap script variant to use. Currently, the variants 
-            supported are  minbase,  which  only  includes  essential  packages and 
-            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. 
- 
-     --make-tarball=FILE 
-            Instead  of  bootstrapping,  make  a  tarball (written to FILE) of the 
-            downloaded packages.  The resulting tarball may be passed to a later 
-            --unpack-tarball. 
-</code> 
- 
-Assuming you want to install additional packages such as zsh or git you can do so by specifying them with the **<nowiki>--include</nowiki>** option. 
- 
----- 
- 
-===== 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.  In a subsequent step we’ll fix the tarball’s owner so that further work with docker can be done by non-root users. 
- 
-<code bash> 
-sudo tar -C wheezy -cf wheezy.tar . 
-sudo chown you:you wheezy.tar 
-</code> 
- 
-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://http.debian.net/debian/ 
-</code> 
- 
-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.1586976849.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki