M1 docker preview and keycloak 'image's platform (linux/amd64) does not match the detected host plat
Posted
技术标签:
【中文标题】M1 docker preview and keycloak \'image\'s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)\' 问题【英文标题】:M1 docker preview and keycloak 'image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)' IssueM1 docker preview and keycloak 'image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8)' 问题 【发布时间】:2021-06-14 04:26:30 【问题描述】:我刚刚下载了 Docker Preview v3.1 https://docs.docker.com/docker-for-mac/apple-m1/ 并尝试运行 keycloak。
还有其他人遇到这个问题吗?
docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:12.0.4
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
【问题讨论】:
【参考方案1】:你可以试试添加这个
--平台linux/amd64
来自
https://github.com/google/cadvisor/issues/2763
https://github.com/Y2Data
【讨论】:
【参考方案2】:刚刚发现这个帖子: https://github.com/docker/for-mac/issues/5310#issuecomment-779791882
使用此图像,我现在可以启动 keycloak。 https://hub.docker.com/r/wizzn/keycloak
【讨论】:
我试过了。在设置 docker 实验功能“使用新的虚拟化框架”(Big Sur 而不是管理程序)后工作。 传奇音乐形式。【参考方案3】:将此片段添加到您的~/.zshrc
和~/.bashrc
。它允许您在执行docker run
命令时不重复标记:
# useful only for Mac OS Silicon M1,
# still working but useless for the other platforms
docker()
if [[ `uname -m` == "arm64" ]] && [[ "$1" == "run" || "$1" == "build" ]]; then
/usr/local/bin/docker "$1" --platform linux/amd64 "$@:2"
else
/usr/local/bin/docker "$@"
fi
【讨论】:
【参考方案4】:对我来说,发生错误是因为我在 M1 芯片 Macbook 上构建 docker 映像,并尝试在 Linux 机器上运行该映像。
这对我有用:
使用需要运行它的同一台机器构建 docker 映像,它工作正常。
【讨论】:
以上是关于M1 docker preview and keycloak 'image's platform (linux/amd64) does not match the detected host plat的主要内容,如果未能解决你的问题,请参考以下文章
[React] Preview and edit a component live with React Live