我想通过使用buildx重建一个 docker 图像以添加对图像arranhs/duckerursim的支持 arm64v8 架构。
执行构建命令后
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v8 -t my-user/my-repository:latest --push .
我收到此错误:
=> ERROR [linux/arm64 11/26] RUN mv /tmp/ursim* /tmp/ursim 0.0s
------
> [linux/arm64 11/26] RUN mv /tmp/ursim* /tmp/ursim:
#45 0.036 mv: cannot stat '/tmp/ursim*': No such file or directory
------
Dockerfile:43
--------------------
41 | RUN rm /tmp/URSim-Linux.tar.gz
42 | # Rename the URSim folder to jus ursim
43 | >>> RUN mv /tmp/ursim* /tmp/ursim
44 |
45 | RUN echo "**** Installing URSim ****"
--------------------
error: failed to solve: process "/bin/sh -c mv /tmp/ursim* /tmp/ursim" did not complete successfully: exit code: 1
前面步骤中的目录和文件好像没有创建?知道为什么吗?
我已经在 ubuntu 机器(我猜它使用 linux/amd64)上尝试了 docker 映像,该映像工作正常。但我想在一台与 Apple m1 芯片配合使用的 Macbook 上工作。
Dockerfile
1 FROM lsiobase/guacgui:latest
2
3 # Set Version Information
4 ARG BUILD_DATE="10/07/20"
5 ARG VERSION="5.8.2.10297"
6 LABEL build_version="URSim Version: ${VERSION} Build Date: ${BUILD_DATE}"
7 LABEL maintainer="Arran Hobson Sayers"
8 LABEL MAINTAINER="Arran Hobson Sayers"
9 ENV APPNAME="URSim"
10
11 # Set Timezone
12 ARG TZ="Europe/London"
13 ENV TZ ${TZ}
14
15 # Setup Environment
16 ENV DEBIAN_FRONTEND noninteractive
17
18 # Set Home Directory
19 ENV HOME /ursim
20
21 # Set robot model - Can be UR3, UR5 or UR10
22 ENV ROBOT_MODEL UR5
23
24 RUN echo "**** Installing Dependencies ****"
25 RUN apt-get update
26 RUN apt-get install -qy --no-install-recommends openjdk-8-jre psmisc
27 # Change java alternatives so we use openjdk8 (required by URSim) not openjdk11 that comes with guacgui
28 RUN update-alternatives --config java
29 #RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 10000
30
31 # Setup JAVA_HOME
32 ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
33
34 RUN echo "**** Downloading URSim ****"
35 # Download URSim Linux tar.gz
36 RUN curl https://s3-eu-west-1.amazonaws.com/ur-support-site/71480/URSim_Linux-5.8.2.10297.tar.gz -o /tmp/URSim-Linux.tar.gz
37 # Extract tarball
38 RUN cd /tmp/
39 RUN tar xvzf /tmp/URSim-Linux.tar.gz
40 #Remove the tarball
41 RUN rm /tmp/URSim-Linux.tar.gz
42 # Rename the URSim folder to jus ursim
43 RUN mv /tmp/ursim* /tmp/ursim #??WHY IT DOENST WORK??
44
45 RUN echo "**** Installing URSim ****"
46 # cd to ursim folder
47 RUN cd /tmp/ursim
48 # Make URControl and all sh files executable
49 RUN chmod +x ./*.sh ./URControl
50 # Stop install of unnecessary packages and install required ones quietly
51 RUN sed -i 's|apt-get -y install|apt-get -qy install --no-install-recommends|g' ./install.sh
52 # Skip xterm command. We dont have a desktop
53 RUN sed -i 's|tty -s|(exit 0)|g' install.sh
54 # Skip Check of Java Version as we have the correct installed and the command will fail
55 RUN sed -i 's|needToInstallJava$|(exit 0)|g' install.sh
56 # Skip install of desktop shortcuts - we dont have a desktop
57 RUN sed -i '/for TYPE in UR3 UR5 UR10/,$ d' ./install.sh
58 # Remove commands that are not relevant on docker as we are root user
59 RUN sed -i 's|pkexec ||g' ./install.sh
60 RUN sed -i 's|sudo ||g' ./install.sh
61 RUN sed -i 's|sudo ||g' ./ursim-certificate-check.sh
62
63 # Install URSim
64 RUN ./install.sh
65 RUN echo "Installed URSim"
66
67 RUN echo "**** Clean Up ****"
68 RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
69
70 # Copy ursim run service script
71 COPY ursim /etc/services.d/ursim
72
73 # Expose ports
74 # Guacamole web browser viewer
75 EXPOSE 8080
76 # VNC viewer
77 EXPOSE 3389
78 # Modbus Port
79 EXPOSE 502
80 # Interface Ports
81 EXPOSE 29999
82 EXPOSE 30001-30004
83
84 # Mount Volumes
85 VOLUME /ursim
86
87 ENTRYPOINT ["/init"]
建造者
我这样创建了构建器:
# Init
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create a builder
docker buildx create --name mybuilder --driver docker-container
# Switch to builder and checkout
docker buildx use mybuilder
docker buildx inspect --bootstrap