Skip to Content
Kubernetes即学即用(第二版)
book

Kubernetes即学即用(第二版)

by Brendan Burns, Joe Beda, Kelsey Hightower
June 2021
Intermediate to advanced
300 pages
5h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Kubernetes即学即用(第二版)
32
2
COPY . .
# This is a set of variables that the build script expects
ENV VERBOSE=0
ENV PKG=github.com/kubernetes-up-and-running/kuard
ENV ARCH=amd64
ENV VERSION=test
# Do the build. Script is part of incoming sources.
RUN build/build.sh
# STAGE 2: Deployment
FROM alpine
USER nobody:nobody
COPY --from=build /go/bin/kuard /kuard
CMD [ "/kuard" ]
Dockerfile
将产生两个镜像。第一是构建镜像,其中包含
Go
编译器、
React.js
工具链以及该程序的源代码。第二个是部署镜像,其中只包含编译好
的二进制文件。利用多阶段构建来构建容器镜像可以让最终的容器镜像缩小
数百兆,从而大幅加快部署速度,因为一般来说,部署的延迟主要取决于网
络性能。该
Dockerfile
生成的最终镜像大约为
20MB
你可以通过以下命令来构建和运行镜像:
$
docker build -t kuard .
$
docker run --rm -p 8080:8080 kuard
2.4
将镜像存储到远程仓库
如果容器镜像只能在一台计算机上使用,那么就大材小用了。
Kubernetes
的基础在于,
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
Python数据分析

Python数据分析

Posts & Telecom Press, Ivan Idris
Python贝叶斯分析(第2版)

Python贝叶斯分析(第2版)

Posts & Telecom Press, Osvaldo Martin
Python高级编程(第2版)

Python高级编程(第2版)

Posts & Telecom Press, Michał Jaworski, Tarek Ziadé

Publisher Resources

ISBN: 9787519856762