The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
场景:
docker拉取nginx镜像,创建容器的时候出错
翻译:拉取的nginx镜像是linux/amd64 架构, 而主机的架构是linux/arm64/v8,没有按要求特定的架构
执行格式错误(遇到执行格式错误就要想是不是架构不一致的问题)
原因:
linux的架构是linux/arm64/v8,nginx镜像的架构是linux/amd64 架构,我们应该拉取自己主机(linux)对应的镜像架构
解决:
1.删除之前的nginx 容器和镜像
2.拉取主机对应的架构(注意:根据自己的错误信息,拉取对应的)
docker pull arm64v8/nginx
过程:网上找了很多方法,都没有解决。说要run的时候加上 – platform/amd64 ,虽然不会报错,但是nginx启动不起开,nginx的状态一直是exited。
参考链接:
https://blog.youkuaiyun.com/ayushu/article/details/128245134?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171950528516800186545755%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171950528516800186545755&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2blogfirst_rank_ecpm_v1~rank_v31_ecpm-1-128245134-null-null.nonecase&utm_term=The%20requested%20images%20platform%20%28linux%2Famd64%29%20does%20not%20match%20the%20detected%20host%20platform%20%28linux%2Farm64%2Fv8%29%20and%20no%20specific%20platform%20was%20requested%203ba74f39a9f20f25080fb7be4312e278d9e6e1e360a6aa9057334d91b&spm=1018.2226.3001.4450