首页 > 其他 > 详细

Images之base image

时间:2018-07-09 14:56:27      阅读:217      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!