Create a base image using docker

Source: Internet
Author: User
Tags docker registry

With a learning attitude, I want to know how to create a basic docker image. So I found a description on the official docker website:

First, the creation of base image is related to the Linux release version to be created. Different releases are different.

The following are examples:

  1. Use the tar command to create a complete image

    Use debootstrap to create Ubuntu base image

$ sudo debootstrap raring raring > /dev/null$ sudo tar -C raring -c . | sudo docker import - raringa29c15f1bf7a$ sudo docker run raring cat /etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=13.04DISTRIB_CODENAME=raringDISTRIB_DESCRIPTION="Ubuntu 13.04"

2. Use scratch to create a base image

There is a scratch in docker registry, and an empty tar file is used to create an image.

$ tar cv --files-from /dev/null | docker import - scratch

Now you can use docker pull to create an image from the smallest container:

FROM scratchCOPY true-asm /trueCMD ["/true"]

The above is dockerfile.


Create a base image using docker

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.