码迷,mamicode.com
首页 > 其他好文 > 详细

Images之base image

时间:2018-07-09 15:24:20      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:eve   import   tool   create   sim   org   amp   ubuntu   not   

Create a base image

 

Most Dockerfiles start from a parent image.

If you need to completely control the contents of your image, you might need to create a base image instead.

Here’s the difference:

  • A parent image is the image that your image is based on. It refers to the contents of the FROM directive in the Dockerfile. Each subsequent declaration in the Dockerfile modifies this parent image. Most Dockerfiles start from a parent image, rather than a base image. However, the terms are sometimes used interchangeably.

  • A base image either has no FROM line in its Dockerfile, or has FROM scratch.

This topic shows you several ways to create a base image. The specific process will depend heavily on the Linux distribution you want to package.

We have some examples below, and you are encouraged to submit pull requests to contribute new ones.

 

 

Create a full image using tar

In general, start with a working machine that is running the distribution you’d like to package as a parent image, though that is not required for some tools like Debian’s Debootstrap, which you can also use to build Ubuntu images.

It can be as simple as this to create an Ubuntu parent image:

$ sudo debootstrap xenial xenial > /dev/null
$ sudo tar -C xenial -c . | docker import - xenial

a29c15f1bf7a

$ docker run xenial cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

  

Images之base image

标签:eve   import   tool   create   sim   org   amp   ubuntu   not   

原文地址:https://www.cnblogs.com/panpanwelcome/p/9283660.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!