IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> Apple M1 使用 dockerfile-maven-plugin 构建镜像失败 -> 正文阅读

[系统运维]Apple M1 使用 dockerfile-maven-plugin 构建镜像失败

解决方案

安装 socat

brew install socat

使用 socat 将 unix socket 代理到 tcp 端口

socat TCP-LISTEN:2375,range=127.0.0.1/32,reuseaddr,fork UNIX-CLIENT:/var/run/docker.sock

设置环境变量 DOCKER_HOST

export DOCKER_HOST=tcp://127.0.0.1:2375

镜像构建成功

[INFO] --- dockerfile-maven-plugin:1.4.13:build (shardingsphere-proxy-bin) @ shardingsphere-integration-test-fixture ---
[INFO] dockerfile: null
[INFO] contextDirectory: /Users/wuweijie/IdeaProjects/shardingsphere/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture
[INFO] Building Docker context /Users/wuweijie/IdeaProjects/shardingsphere/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture
[INFO] Path(dockerfile): null
[INFO] Path(contextDirectory): /Users/wuweijie/IdeaProjects/shardingsphere/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture
[INFO] 
[INFO] Image will be built as apache/shardingsphere-proxy-test:latest
[INFO] 
[INFO] Step 1/11 : FROM openjdk:8-jdk-alpine
[INFO] 
[INFO] Pulling from library/openjdk
[INFO] Image 0362ad1dd800: Pulling fs layer
[INFO] Image 571218f61883: Pulling fs layer
[INFO] Image abe576d65b4c: Pulling fs layer
[INFO] Image 571218f61883: Downloading
[INFO] Image 571218f61883: Verifying Checksum
[INFO] Image 571218f61883: Download complete
[INFO] Image 0362ad1dd800: Downloading
[INFO] Image abe576d65b4c: Downloading
[INFO] Image 0362ad1dd800: Verifying Checksum
[INFO] Image 0362ad1dd800: Download complete
[INFO] Image 0362ad1dd800: Extracting
[INFO] Image 0362ad1dd800: Pull complete
[INFO] Image 571218f61883: Extracting
[INFO] Image 571218f61883: Pull complete
[INFO] Image abe576d65b4c: Verifying Checksum
[INFO] Image abe576d65b4c: Download complete
[INFO] Image abe576d65b4c: Extracting
[INFO] Image abe576d65b4c: Pull complete
[INFO] Digest: sha256:94792824df2df33402f201713f932b58cb9de94a0cd524164a0f2283343547b3
[INFO] Status: Downloaded newer image for openjdk:8-jdk-alpine
[INFO]  ---> e4105db9d469
[INFO] Step 2/11 : ARG APP_NAME
[INFO] 
[INFO]  ---> Running in a45c265a7eff
[INFO] Removing intermediate container a45c265a7eff
[INFO]  ---> 46a87b168ea2
[INFO] Step 3/11 : ADD target/${APP_NAME}.tar.gz /opt
[INFO] 
[INFO]  ---> a931814b7ec4
[INFO] Step 4/11 : RUN mv /opt/${APP_NAME} /opt/shardingsphere-proxy
[INFO] 
[INFO]  ---> Running in 71a22a8f1692
[INFO] Removing intermediate container 71a22a8f1692
[INFO]  ---> cbe6b7d6a9a3
[INFO] Step 5/11 : EXPOSE 3307
[INFO] 
[INFO]  ---> Running in 091095a271fb
[INFO] Removing intermediate container 091095a271fb
[INFO]  ---> e8ecdb2881c2
[INFO] Step 6/11 : EXPOSE 3308
[INFO] 
[INFO]  ---> Running in a32bfd3031d7
[INFO] Removing intermediate container a32bfd3031d7
[INFO]  ---> 9d6e24f81961
[INFO] Step 7/11 : WORKDIR /opt/shardingsphere-proxy
[INFO] 
[INFO]  ---> Running in f36b96a8c1e9
[INFO] Removing intermediate container f36b96a8c1e9
[INFO]  ---> 8837c5a4507c
[INFO] Step 8/11 : RUN cat bin/start.sh | tr -d '\r' > _start.sh && mv _start.sh bin/start.sh
[INFO] 
[INFO]  ---> Running in 9906de0e1fac
[INFO] Removing intermediate container 9906de0e1fac
[INFO]  ---> a5298ce74ff4
[INFO] Step 9/11 : RUN cat bin/stop.sh | tr -d '\r' > _stop.sh && mv _stop.sh bin/stop.sh
[INFO] 
[INFO]  ---> Running in f28d4cc7ada5
[INFO] Removing intermediate container f28d4cc7ada5
[INFO]  ---> 110595b1750e
[INFO] Step 10/11 : RUN chmod +x -R ./bin
[INFO] 
[INFO]  ---> Running in a90ea4730981
[INFO] Removing intermediate container a90ea4730981
[INFO]  ---> d1ce855711a4
[INFO] Step 11/11 : CMD /opt/shardingsphere-proxy/bin/start.sh && tail -f /opt/shardingsphere-proxy/logs/stdout.log
[INFO] 
[INFO]  ---> Running in 27fc7eeaad04
[INFO] Removing intermediate container 27fc7eeaad04
[INFO]  ---> ec5562dbdc6f
[INFO] Successfully built ec5562dbdc6f
[INFO] Successfully tagged apache/shardingsphere-proxy-test:latest
[INFO] 
[INFO] Detected build of image with id ec5562dbdc6f
[INFO] Building jar: /Users/wuweijie/IdeaProjects/shardingsphere/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/target/shardingsphere-integration-test-fixture-5.0.0-RC1-SNAPSHOT-docker-info.jar
[INFO] Successfully built apache/shardingsphere-proxy-test:latest

原因分析

macOS + Docker Desktop

Docker 在本地一般使用 unix socket 和 Docker daemon 交互,可能 dockerfile-maven-plugin 所引用的库还没支持 macOS aarch64,无法使用 unix socket,导致在 macOS aarch64 使用 dockerfile-maven-plugin 构建镜像报错。

从报错信息初步判断,是创建和 unix socket 的连接出现了问题

java.lang.UnsatisfiedLinkError: /private/var/folders/vg/n0l55hdj5037l7rdjth2t2040000gn/T/jffi4267946790751720772.dylib: dlopen(/private/var/folders/vg/n0l55hdj5037l7rdjth2t2040000gn/T/jffi4267946790751720772.dylib, 1): no suitable image found.  Did find:
	/private/var/folders/vg/n0l55hdj5037l7rdjth2t2040000gn/T/jffi4267946790751720772.dylib: no matching architecture in universal wrapper
	/private/var/folders/vg/n0l55hdj5037l7rdjth2t2040000gn/T/jffi4267946790751720772.dylib: no matching architecture in universal wrapper
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1953)
	at com.kenai.jffi.internal.StubLoader.loadFromJar(StubLoader.java:371)
	at com.kenai.jffi.internal.StubLoader.load(StubLoader.java:258)
	at com.kenai.jffi.internal.StubLoader.<clinit>(StubLoader.java:444)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at com.kenai.jffi.Init.load(Init.java:68)
	at com.kenai.jffi.Foreign$InstanceHolder.getInstanceHolder(Foreign.java:49)
	at com.kenai.jffi.Foreign$InstanceHolder.<clinit>(Foreign.java:45)
	at com.kenai.jffi.Foreign.getInstance(Foreign.java:103)
	at com.kenai.jffi.Type$Builtin.lookupTypeInfo(Type.java:242)
	at com.kenai.jffi.Type$Builtin.getTypeInfo(Type.java:237)
	at com.kenai.jffi.Type.resolveSize(Type.java:155)
	at com.kenai.jffi.Type.size(Type.java:138)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.NativeRuntime$TypeDelegate.size(NativeRuntime.java:187)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.AbstractRuntime.<init>(AbstractRuntime.java:48)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:66)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.NativeRuntime.<init>(NativeRuntime.java:41)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.NativeRuntime$SingletonHolder.<clinit>(NativeRuntime.java:62)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.NativeRuntime.getInstance(NativeRuntime.java:58)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.jffi.Provider.<init>(Provider.java:29)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
	at java.base/java.lang.Class.newInstance(Class.java:645)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.getInstance(FFIProvider.java:68)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.FFIProvider$SystemProviderSingletonHolder.<clinit>(FFIProvider.java:57)
	at com.spotify.docker.client.shaded.jnr.ffi.provider.FFIProvider.getSystemProvider(FFIProvider.java:35)
	at com.spotify.docker.client.shaded.jnr.ffi.LibraryLoader.create(LibraryLoader.java:73)
	at com.spotify.docker.client.shaded.jnr.unixsocket.Native.<clinit>(Native.java:76)
	at com.spotify.docker.client.shaded.jnr.unixsocket.UnixSocketChannel.<init>(UnixSocketChannel.java:101)
	at com.spotify.docker.client.shaded.jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:60)
	at com.spotify.docker.client.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:69)
	at com.spotify.docker.client.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:44)
	at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:118)
	at com.spotify.docker.client.shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at com.spotify.docker.client.shaded.org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at com.spotify.docker.client.shaded.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:435)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector$1.run(ApacheConnector.java:491)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at jersey.repackaged.com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
	at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:50)
	at jersey.repackaged.com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:37)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:487)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:178)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340)
	at com.spotify.docker.client.shaded.org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2021-10-07 14:11:49  更:2021-10-07 14:13:03 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 18:34:32-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码