什么是Distroless容器镜像
本文最后更新于 1340 天前,其中的信息可能已经有所发展或是发生改变。

什么是Distroless容器镜像

GoogleContainerTools 的 distroless基础镜像经常被称为生产小型、快速和安全容器的方法之一。

如果你想在容器内调试你程序,你需要 shell 和其他一些已安装的工具,但 distroless 没有这些,这时使用普通镜像进行开发。

为什么要使用 distroless 镜像

将运行时容器中的内容限制为您的应用程序所必需的内容是 Google 和其他技术巨头采用的最佳实践,这些技术巨头已在生产环境中使用容器多年。它避免了很多不必要的漏洞,减轻了许多安全上的负担。

Distroless 镜像非常小:

比如最小的 distroless镜像:gcr.io/distroless/static-debian11大约 2 M。下图为github上的介绍

image-20221218000702828

谁在使用disroless

支持开箱即用的最流行开发语言

distroless 支持开箱即用的最流行的运行开发语言:

具体使用情况

参考github上的例子:https://github.com/GoogleContainerTools/distroless/tree/main/examples

distroless 用于 Python 应用的例子

FROM python:3-slim AS build-env
COPY . /app
WORKDIR /app

FROM gcr.io/distroless/python3
COPY --from=build-env /app /app
WORKDIR /app
CMD ["hello.py", "/etc"]

生产中什么情况应该使用 distroless

如果注重推拉取镜像的速度和容器的安全性,或者用于生产环境,可以用 distroless

因为distroless 镜像更轻,这意味着更快的拉取和推送。Docker 提供了一个超级最小的镜像,当你使用它作为镜像的基础时,它不会创建额外的层。

安全性也是一个重要问题,如果不打算使用 sudo、ping、ls 之类的工具,容器中也不应该使用它们。

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇