如何为 Docker 制作自己的基础镜像? [英] How can I make my own base image for Docker?
问题描述
根据 Docker 文档,要构建自己的镜像,您必须始终使用 FROM
指令指定基本图像.
According to the Docker documentation, to build your own image, you must always specify a base image using the FROM
instruction.
显然,Docker 索引中有很多图像可供选择,但如果我想怎么办建立我自己的?这可能吗?
Obviously, there are lots of images to choose from in the Docker index, but what if I wanted to build my own? Is that possible?
如果我理解正确的话,图像 base
是基于 Ubuntu 构建的,我想用 Debian 图像进行试验.另外,我想真正了解 Docker 的工作原理,而 base
镜像对我来说仍然是一个黑盒.
The image base
is built off Ubuntu if I understand correctly, and I want to experiment with a Debian image. Plus, I want to really understand how Docker works, and the base
image is still a blackbox for me.
推荐答案
您可以查看基本图像的创建方式并从那里开始.
You can take a look at how the base images are created and go from there.
您可以在这里找到它们:https://github.com/dotcloud/docker/tree/master/contrib.有 mkimage-busybox.sh、mkimage-unittest.sh、mkimage-debian.sh
You can find them here: https://github.com/dotcloud/docker/tree/master/contrib. There is mkimage-busybox.sh, mkimage-unittest.sh, mkimage-debian.sh
这篇关于如何为 Docker 制作自己的基础镜像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!