1: failed to solve: alpine:latest: failed to do request
这个错误我的解决办法是:
更换网络环境,原本连接的是内网,下载失败,换成手机wifi后解决了
2:exec:xxx.sh no such file or directory
首先查看Dockerfile和脚本是不是都是unix的,vi进入文件,再:set ff查看
解决办法是:
重写Dockerfile,Dockerfile有问题,不要写那么多复杂的路径,
FROM centos:7
COPY xxx.sh /usr/local/xxx.sh
WORKDIR /usr/local/
CMD ['xxx.sh']
FROM centos:7
WORKDIR /home
COPY xxx.sh xxx.sh
ENTRYPOINT sh xxx.sh
将上面的改为下面的就可以打包镜像了
3:exec: "xxx.sh": executable file not found in $PATH: unknown
和2的方法一样,修改Dockerfile,路径尽量简单
4:push到自己的registry发生错误:The push refers to repository [xxxx.xxxx.xxxx.xxxx/test12] Get "https://xxxx.xxxx.xxxx:5000/v2/": http: server gave HTTP response to HTTPS client
解决办法:修改/etc/docker/deamon.json,将其他的insecure-registries先删除,只留下自己docker的insecure-registries,等push完后再修改回来。文章来源:https://www.toymoban.com/news/detail-649940.html
systemctl restart docker或者 systemctl restart docker.socket文章来源地址https://www.toymoban.com/news/detail-649940.html
到了这里,关于将shell脚本打成镜像时遇到的错误的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!