当前位置:网站首页>Introduction and basic use of container image construction tool kaniko (googlecontainertools/kaniko)
Introduction and basic use of container image construction tool kaniko (googlecontainertools/kaniko)
2022-07-18 00:49:00 【Learn programming notes】
Kaniko
GoogleContainerTools/kaniko
What is it? ?
- Tools for building container images
- Do not rely on Docker, Unwanted root jurisdiction
- Reproducible container image construction
gcr.io/kaniko-project/executor:latest
gcr.io/kaniko-project/executor:debug - contain shell
Reference resources
- GitLab runner use Kaniko
Focus on Kubernetes Build a mirror image
CAUTION
- Only support x86_64
- I won't support it multi-arch and manifest
- Cannot use local layer cache
- Performance may be weaker than dind - GoogleContainerTools/kaniko#875
- registry-mirror Prefix is not supported , for example
registry.example.com/dockerhub
# debug Environmental Science
docker run --rm -it -w /workspace --entrypoint sh registry.cn-hongkong.aliyuncs.com/cmi/kaniko-project_executor:debug
mkdir -p /workspace /images /cache
cd /workspace
cat <<DOCKERFILE > Dockerfile FROM wener/base RUN apk add coreutils DOCKERFILE
# --no-push Don't push --tarPath Generated tar Need to set up --destination
# --context Default /workspace
# --cache Enable cache --cache-dir Basic image cache directory , Default /cache --cache-repo Cache warehouse
# --use-new-run Experimental characteristics , Improve build performance
# --reproducible Remove timestamp
/kaniko/executor --context $PWD --dockerfile $PWD/Dockerfile \
--registry-mirror hbcvocvo.mirror.aliyuncs.com \
--no-push --tarPath /images/build.tar --destination=image \
--use-new-run --reproducible
# Docker Authentication configuration
mkdir -p /kaniko/.docker
# To configure
echo "{
\"auths\":{
\"$CI_REGISTRY\":{
\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# Build and push
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
# Build... Directly
# registry.cn-hongkong.aliyuncs.com/cmi/kaniko-project_executor:latest
# gcr.io/kaniko-project/executor:latest
docker run \
-v "$HOME"/.config/gcloud:/root/.config/gcloud \
-v /path/to/context:/workspace \
registry.cn-hongkong.aliyuncs.com/cmi/kaniko-project_executor:latest \
--dockerfile /workspace/Dockerfile \
--destination "$PROJECT_ID/$IMAGE_NAME:$TAG" \
--context dir:///workspace/
dockerhub
cat <<JSON > config.json { "auths": { "https://index.docker.io/v1/": { "auth": "$(echo -n $USER:$PASSWORD | base64)" } } } JSON
docker run --rm -it $PWD/config:/kaniko/.docker/config.json --destination=yourimagename
Parameters
FAQ
Performance issues
- https://github.com/GoogleContainerTools/kaniko/issues/875 Kaniko build’s performance much slower comparing with DID solution
The copy root directory is abnormally blocked
FROM alpine:3.11 as rootfs
RUN echo 7777
FROM alpine:3.11
# Blocking
COPY --from=rootfs / /sysroot/
# Workaround https://github.com/GoogleContainerTools/kaniko/issues/960
COPY --from=rootfs /rootfs/ /sysroot/
snapshot Blocking
Reference link :https://wener.me/notes/devops/container/kaniko
边栏推荐
- mysql进阶(三)游标简易知识点汇总
- 002. Write string inversion cases
- The popularity of NFT IP licensing is rising, and the era of nft2.0 is coming?
- Q3 qmainwindow status bar riveted parts core parts
- Prometheus operator deployment
- 【学习笔记】树形dp
- Analysis of eip-2535 diamond agreement from the Saudi NFT event
- This SQL will report an error when it is executed in pg. Oracle is OK
- H5 start applet
- [mathematical modeling summer training] MATLAB data preprocessing
猜你喜欢

MFC file reading and writing based on a single document
![[mathematical modeling summer training] MATLAB data preprocessing](/img/16/dabf45cd04484ab2b7dae962740172.png)
[mathematical modeling summer training] MATLAB data preprocessing

002. Write string inversion cases
![[source code] implementation principle of HashSet](/img/6e/4cc6e4fffd0d6802a8338286a558d5.png)
[source code] implementation principle of HashSet

An East goods order code # install dependencies

聊天软件项目开发1
![[source code] what is the difference between ArrayList and vector, and the difference of expansion multiple](/img/b2/8b03ca0058d762cd1572dbe52f9662.png)
[source code] what is the difference between ArrayList and vector, and the difference of expansion multiple

SHAREit Group的技术战略——开放、自立、超前布局

【面试题】在 Queue 中 poll()和 remove()有什么区别

【数学建模暑期培训】Matlab之求代数方程的符号解和数值解
随机推荐
MySQL advanced (III) summary of cursor simple knowledge points
科技公司纷纷反对 英国网络安全法案搁置
[mathematical modeling summer training] data processing of MATLAB
MFC控件学习:图片(bmp/png)
Luogu daily three questions -- the next day
2019ccpc Qinhuangdao HDU - 6736 F - Forest Program (DFS ring finding Combinatorial Mathematics)
Electric razor touch chip-dlt8t10s-jericho
MFC control learning: pictures (bmp/png)
Q4 resource file 2
463 sword finger offer- (09, 30, 06, 24)
大家有没有遇到过flink-oracle-cdc 获取最新的日志 卡住的情况?怎么解决?
Huitong programming introductory course - 3 colorful
The first day of three daily questions in Luogu
001.Hello World
MFC control learning: button
大端字节序和小端字节序
Prometheus operator deployment
GCC rust is approved to be included in the mainline code base, or will meet you in GCC 13
rez:Ephemeral packages
【黄啊码】MySQL入门—3、我用select *,老板直接赶我坐火车回家去,买的还是站票