Docker Images Explore

Docker Images Explore

scratch

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

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.

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:

A base image has no parent image specified in its Dockerfile. It is created using a Dockerfile with the FROM scratch directive.

在这里插入图片描述

hello-world

  • https://github.com/docker-library/hello-world
FROM scratch
COPY hello /
CMD ["/hello"]

alpine

A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size!

FROM scratch
ADD alpine-minirootfs-20221110-x86_64.tar.gz /
CMD ["/bin/sh"]

minirootfs

ubuntu

FROM scratch
ADD ubuntu-bionic-oci-amd64-root.tar.gz /
CMD ["bash"]

在这里插入图片描述

centos

FROM scratch
ADD centos-7-x86_64-docker.tar.xz /

LABEL xxxxxx

CMD ["/bin/bash"]

在这里插入图片描述

busybox

FROM scratch
ADD busybox.tar.xz /
CMD ["sh"]
# 用完就删
docker run -it --rm busybox

httpd

Apache HTTP Server

# 后台运行
docker run -d -p 80:80 httpd

在这里插入图片描述

tomcat

docker run -d -p 8080:8080 tomcat

docker exec -it tomcat容器ID bash

cd webapps.dist
cp -r . ../webapps

在这里插入图片描述

nginx

docker run -d -p 80:80 nginx

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值