Categories

Last articles

Archives

Tags

3.3.2 451 group 451 research apache APIs app store appcenter apphub Appliance appliance Appliance Template appliance template application delivery application marketplace apx aws AWS aws marketplace Azure azure bento boxes bfm business big data Billing cisco citrix cloud Cloud Computing cloud computing cloud expo cloud hybride cloud migration cloud migrations cloud onboarding cloud server images cloudplatform cloudscape CloudStack cloudstack cloudwatt collaboration container crayon custom software DEB

Share

How to Build Docker Base Images

Written by Jean-Fran├žois Knoepfli - 26 october 2015

This is the second in our series of Docker blog posts. The first post, by James our CTO, focused on why UShareSoft for Docker software governance and transparency. In this post, we'll tell you exactly how to build a Docker base image using our tools.

By a base image, we mean a machine image containing just the necessary bits required to launch your container image. You can do this in two ways: using our UForgeNow SaaS platform, or using hammr, an open source tool for creating machine images for different environments from a single configuration file.

First, you need to register for a UForgeNow account here. Read our basic tutorials to help you get started with UForge.

If you wish to use hammr, you can download the tool and find out more about using it here.

Using UForgeNow

  1. Create your appliance template using your chosen operating system (CentOS, Fedora, Debian, Ubuntu ....) and selecting the OS profile of your choice. Selecting the "Minimal" OS profile will create a skeleton template with the minimum number of packages required to boot your image. (Read the "How to create a template" tutorial if needed.)create base image
  2. You can further reduce the number of packages manually to remove packages such as kernel, mkinitrd, e2fsprogs, etc. which are not necessary within a container environment. This is an optional step.remove packages
  3. Once your template contains all the required software and configuration information, generate a machine image in the tar.gz format and download the final image.generate image
  4. Use the docker import command e.g. cat image.tar.gz | docker import - myDockerImageName
  5. Use the docker images command to confirm that the image has been created.
  6. Launch your image using the usual docker run commands e.g. docker run --rm -i -t myDockerImageName bash. This will launch a bash that is located within the container.

Using Hammr

  1. Create a hammr template file (called template.json) with your chosen operating system. (Check out hammr documentation if you are unsure how to do this.) This template file is the equivalent of a docker file and will be used as the basis for your Docker image.
  2. Use the hammr template command to create an appliance template on the UForgeNow server
  3. Use the hammr template build command to generate a machine image in the tar.gz format
  4. Use the hammr image download command to download the image.
  5. Follow the steps 4 - 6 above to launch your container.

As an example, click here to download a tar.gz containing a hammr template file to generate a base Docker image with CentOS 7. This includes:

As mentioned in our previous post, the advantages of using UForgeNow and hammr to build your Docker images include:

 


Share this post : Identi.ca Twitter Digg Stumble Delicious Technorati Facebook

Classified in : Cloud Computing, Technology, Tutorial - Tags : docker, uforge, dockerfile, hammr, uforgenow, container


Write a comment











What is the last letter of the word zxucaf? :