Skaffold在Apple M1上使用Docker:如何确保使用Rosetta 2而不是QEMU仿真器?

iqih9akk  于 2023-05-28  发布在  Docker
关注(0)|答案(1)|浏览(260)

我有一台M1机器(arch arm 64),并试图用platform=linux/amd64构建一个docker-image。

  • 当我尝试从终端构建如下:docker build --platform linux/amd64 .它工作正常。
  • 当我尝试使用skaffold buil构建Skaffold时,我得到了下面的错误
### Skaffold.yaml, artifact build.
      - image: $IMAGE
        context: .
        custom:
          buildCommand: docker build --platform linux/amd64 .

PS:我已经正确安装了Rosetta 2,并通过我的Docker-desktop激活。
似乎Skaffold正在使用QEMU模拟器而不是Rosetta 2

6 97.59 debconf:延迟软件包配置,因为没有安装apt-utils #6 97.70 Fetched 35.6 MB in 57 s(628 kB/s)#6 97.74 Error while loading /usr/sbin/dpkg-split:没有这样的文件或目录#6 97.75 Error while loading /usr/sbin/dpkg-deb:没有这样的文件或目录#6 97.75 dpkg:处理archive /var/cache/apt/archives/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb(--unpack)时出错:#6 97.75 dpkg-deb --control subprocess returned error exit status 1 #6 97.75加载/usr/sbin/dpkg-split时出错:没有这样的文件或目录#6 97.75 Error while loading /usr/sbin/dpkg-deb:没有这样的文件或目录#6 97.75 dpkg:/var/cache/apt/archives/libpython3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb(--unpack):#6 97.75 dpkg-deb --control subprocess returned error exit status 1 #6 97.76加载/usr/sbin/dpkg-split时出错:没有这样的文件或目录#6 97.76 Error while loading /usr/sbin/dpkg-deb:没有这样的文件或目录#6 97.76 dpkg:/var/cache/apt/archives/libexpat1_2.2.9-1ubuntu0.6_amd64.deb(--unpack):#6 97.76 dpkg-deb --control subprocess returned error exit status 1 #6 97.76加载/usr/sbin/dpkg-split时出错:没有这样的文件或目录#6 97.77 Error while loading /usr/sbin/dpkg-deb:没有这样的文件或目录#6 97.77 dpkg:/var/cache/apt/archives/python3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb(--unpack):#6 97.77 dpkg-deb --control subprocess returned error exit status 1 #6 97.78处理时遇到错误:#6 97.78 /var/cache/apt/archives/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb #6 97.78/var/cache/apt/archives/libpython3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb #6 97.78/var/cache/apt/archives/libexpat1_2.2.9-1ubuntu0.6_amd64.deb #6 97.78/var/cache/apt/archives/python3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb #6 97.86 E:子进程/usr/bin/dpkg返回错误代码(1)#6 ERROR:executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update && apt-get install -y software-properties-common && apt-get update && add-apt-repository -y ppa:alex-p/tesseract-ocr5 && add-apt-repository -y ppa:reviczky/xxhash && apt-get update && apt-get install -y

libgl1 tesseract-ocr poppler-utils fonts-liberation
libtiff5-dev libjpeg-turbo8-dev libopenjp2-7-dev
zlib1g-dev libfreetype6-dev libcms2-dev libwebp-dev
tcl8.6-dev tk8.6-dev python3-tk libharfbuzz-dev libfribidi-dev libxcb1-dev libspatialindex-dev python3-dev
wget make curl python3.8-venv git build-essential python-is-python3 xxhash && rm -rf /var/lib/apt/lists/]:退出代码:100 ------ > [the_img 2/37] RUN apt-get update && apt-get install -y software-properties-common && apt-get update &&
add-apt-repository -y ppa:alex-p/tesseract-ocr5 &&
add-apt-repository -y ppa:reviczky/xxhash && apt-get update &&
apt-get install -y libgl1 tesseract-ocr poppler-utils
libjpeg-turbo8-dev
libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev libspatialindex-dev
python3-dev wget make curl python3.8-venv git
build-essential python-is-python3 xxhash && rm -rf /var/lib/apt/lists/
:#6 97.76加载/usr/sbin/dpkg-split时出错:没有这样的文件或目录#6 97.77 Error while loading /usr/sbin/dpkg-deb:没有这样的文件或目录#6 97.77 dpkg:/var/cache/apt/archives/python3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb(--unpack):#6 97.77 dpkg-deb --control subprocess returned error exit status 1 #6 97.78处理时遇到错误:#6 97.78 /var/cache/apt/archives/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb #6 97.78/var/cache/apt/archives/libpython3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb #6 97.78/var/cache/apt/archives/libexpat1_2.2.9-1ubuntu0.6_amd64.deb #6 97.78/var/cache/apt/archives/python3.8-minimal_3.8.10-0ubuntu1~20.04.7_amd64.deb #6 97.86 E:子进程/usr/bin/dpkg返回错误代码(1)------ ERROR:未能解决:executor无法运行[/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update && apt-get install -y software-properties-common && apt-get update &&
add-apt-repository -y ppa:alex-p/tesseract-ocr5 &&
add-apt-repository -y ppa:reviczky/xxhash && apt-get update &&
apt-get install -y libgl1 tesseract-ocr poppler-utils
libjpeg-turbo8-dev
libopenjp2-7-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
libharfbuzz-dev libfribidi-dev libxcb1-dev libspatialindex-dev

python3-dev wget make curl python3.8-venv git
build-essential python-is-python3 xxhash && rm -rf /var/lib/apt/lists/*]:退出代码:100正在清理...错误:卸载:释放未加载:keycloak:release:未找到错误:uninstall:未加载版本:代理:发布:未找到错误:uninstall:未加载版本:minio:release:未找到错误:uninstall:未加载版本:mock-model-registry:未找到

  • 我试着运行arch -x86_64 skaffold build
  • 我安装了Rosetta 2并激活了它。
  • 看起来Skaffold使用的是QEMU模拟器而不是Rosetta 2
  • 我想确保Skaffold正在使用Rosetta 2
6kkfgxo0

6kkfgxo01#

我通过这三个步骤解决了这个问题:
1.已将Skaffold更新到最新版本brew update skaffold
1.更新Rosetta softwareupdate --install-rosetta --agree-to-license
1.将docker-desktop从最新版本(4.19.0)降级到4.17.0

相关问题