我想将docker-maven-plugin (0.33.0)与podman (2.0.6)一起使用。根据这个问题,这应该是可能的 - 在实验阶段。这就是我所做的。
为 docker 设置别名
alias docker=podman
启动 podman REST 服务
podman system service -t 0 &
将 DOCKER_HOST 设置为套接字文件
unix:/run/user/7001/podman/podman.sock
尝试从 dockerfile 构建图像
mvn docker:build
并得到:
[INFO] Building tar: /[...]/tmp/docker-build.tar
[INFO] DOCKER> [myapp:latest] "myapp": Created docker-build.tar in 918 milliseconds
Sep 02, 2020 2:39:24 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (jnr.enxio.channels.NativeException) caught when processing request to {}->unix://127.0.0.1:1: Connection reset by peer
Sep 02, 2020 2:39:24 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://127.0.0.1:1
Sep 02, 2020 2:39:25 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (jnr.enxio.channels.NativeException) caught when processing request to {}->unix://127.0.0.1:1: Connection reset by peer
Sep 02, 2020 2:39:25 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://127.0.0.1:1
Sep 02, 2020 2:39:25 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (jnr.enxio.channels.NativeException) caught when processing request to {}->unix://127.0.0.1:1: Connection reset by peer
Sep 02, 2020 2:39:25 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://127.0.0.1:1
[ERROR] DOCKER> Unable to build image [myapp] : Connection reset by peer [Connection reset by peer]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
看来,这不是权限问题。我可以使用 curl 和同一个用户连接到套接字
curl -i --unix-socket /run/user/7001/podman/podman.sock http://localhost/info
... 200 OK ... and json payload
知道我的设置可能出了什么问题吗?