scratch 镜像

链接:https://hub.docker.com/_/scratch/

摘要

an explicitly empty image, especially for building images “FROM scratch”

  • 空白的镜像,特别适用于构建镜像 FROM scratch
  • 超小镜像

    详情

    This image is most useful in the context of building base images (such as debian and busybox) or super minimal images (that contain only a single binary and whatever it requires, such as hello-world). As of Docker 1.5.0 (specifically, > docker/docker#8827), > FROM scratch is a no-op in the > Dockerfile, and will not create an extra layer in your image (so a previously 2-layer image will be a 1-layer image instead). scratch 镜像非常适用于构建基础镜像(如 debian and busybox )或者超小镜像(包含一个单独的二进制包和该包所需要的,比如 hello world
    在 Docker 1.5.0, FROM scratch 是无操作的 Dockerfile , 不会在镜像中创建额外的层。 You can use Docker’s reserved, minimal image, scratch, as a starting point for building containers. Using the scratch “image” signals to the build process that you want the next command in the Dockerfile to be the first filesystem layer in your image.

你可以使用 Docker 预留的、最小镜像的 scratch , 作为构建容器的开端。在 Dockerfile 中使用 scratch 镜像表示你想在接下来的命令中把 Dockerfile 作为你容器中的第一层文件系统。

While scratch appears in Docker’s repository on the hub, you can’t pull it, run it, or tag any image with the name scratch. Instead, you can refer to it in your Dockerfile. For example, to create a minimal container using scratch:

scratch 出现在 Docker 的仓库中,你不能拉取、运行或打 tag。相反,你可以在 DockerFile 中指向此镜像。举例,你可以创建一个使用 scratch 的最小镜像:

  1. FROM scratch
  2. COPY hello /
  3. CMD ["/hello"]

alpine

alpine 比起 scratch 多了一些常用工具。