快捷菜单
常用功能一站直达
更多功能请点顶栏「快捷菜单」

[toc]
1docker 20.10.21
2go version go1.192023.1.8-docker构建镜像测试


go环境和docker环境已经具备。

Dockerfile内容:

build文件内容:

1[root@docker ~]#mkdir admission-webhook && cd admission-webhook
2[root@docker admission-webhook]#git clone https://github.com/cnych/admission-webhook-example.git
3Cloning into 'admission-webhook-example'...
4remote: Enumerating objects: 170, done.
5remote: Counting objects: 100% (11/11), done.
6remote: Compressing objects: 100% (10/10), done.
7remote: Total 170 (delta 1), reused 5 (delta 1), pack-reused 159
8Receiving objects: 100% (170/170), 229.27 KiB | 0 bytes/s, done.
9Resolving deltas: 100% (88/88), done.
10[root@docker admission-webhook]#cd admission-webhook-example/
11[root@docker admission-webhook-example]#git checkout train4
12Branch train4 set up to track remote branch train4 from origin.
13Switched to a new branch 'train4'可以看到,有报错:
1[root@docker admission-webhook-example]#export DOCKER_USER=onlyonexl
2[root@docker admission-webhook-example]#./build
3go: k8s.io/api@v0.25.4 requires
4 github.com/stretchr/testify@v1.8.0: missing go.sum entry; to add it:
5 go mod download github.com/stretchr/testify
6Sending build context to Docker daemon 348.2kB
7Step 1/3 : FROM alpine:latest
8latest: Pulling from library/alpine
959bf1c3509f3: Already exists
10Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300
11Status: Downloaded newer image for alpine:latest
12 ---> c059bfaa849c
13Step 2/3 : ADD admission-webhook-example /admission-webhook-example
14ADD failed: file not found in build context or excluded by .dockerignore: stat admission-webhook-example: file does not exist
15The push refers to repository [docker.io/onlyonexl/admission-webhook-example]
16An image does not exist locally with the tag: onlyonexl/admission-webhook-example

https://blog.csdn.net/u012275249/article/details/117296408

失败:

https://zhuanlan.zhihu.com/p/462402771

失败:

总结:感觉是go的版本不一样导致的……
项目的go版本:go 1.19

而我的机器上go版本是:go 1.16.2



这里为什么会被拒绝了呢?(可能是要先手动登录一下自己的dockerhub呢……)
可以看到,这里的惊险已经构建好了:

这里手动登录下自己的dockerhub账号:

这补救推送成功了吗哈哈:

我的博客主旨:
🍀 微信二维码 x2675263825 (舍得), qq:2675263825。

🍀 微信公众号 《云原生架构师实战》

🍀 博客 www.onlyyou520.com


🍀 csdn https://blog.csdn.net/weixin_39246554?spm=1010.2135.3001.5421

🍀 知乎 https://www.zhihu.com/people/foryouone

好了,关于本次就到这里了,感谢大家阅读,最后祝大家生活快乐,每天都过的有意义哦,我们下期见!
日历 · 精选 · 友链 · 更多
如果内容对你有帮助,欢迎请我喝杯咖啡 ☕



One的公众号
爱折腾博客的小白