Closed tnk4on closed 2 years ago
@tnk4on I don't think this a buildah issue it seems to be failing at very early level hence moving it to podman. I don't have a remote
setup but sharing --log-level=debug
could be helpful.
I think this already fixed in the main branch, see https://github.com/containers/podman/issues/11732
@flouthoc Thank you for moving the issue! The debug log is below.
# podman --log-level debug -r build -t test2 .
INFO[0000] podman filtering at log level debug
DEBU[0000] Called build.PersistentPreRunE(podman --log-level debug -r build -t test2 .)
DEBU[0000] SSH Ident Key "/root/.ssh/id_ecdsa" SHA256:7DMAeeupk5yNBFP/DOVVtKFKn21/uJwLBTZht9JjWz4 ecdsa-sha2-nistp256
DEBU[0000] DoRequest Method: GET URI: http://d/v4.0.0/libpod/_ping
DEBU[0000] SSH Ident Key "/root/.ssh/id_ecdsa" SHA256:7DMAeeupk5yNBFP/DOVVtKFKn21/uJwLBTZht9JjWz4 ecdsa-sha2-nistp256
DEBU[0000] DoRequest Method: GET URI: http://d/v4.0.0/libpod/_ping
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf"
DEBU[0000] Loading registries configuration "/etc/containers/registries.conf.d/000-shortnames.conf"
DEBU[0000] DoRequest Method: POST URI: http://d/v4.0.0/libpod/build
Error: stat /var/tmp/libpod_builder150168969/build/root/build-test/test2/Containerfile: no such file or directory
@Luap99 Thanks for the information on the related issue. As far as I've tried on my macOS, this issue doesn't seem to be fixed...
The path is slightly different between your error and the old one:
/var/tmp/libpod_builder150168969/build/root/build-test/test2/Containerfile
while the old one was /var/tmp/libpod_builder324688225/build/Dockerfile
. I guess the problem is the extra root/build-test/test2
in the path.
Sorry for the confusion. The debug log was re-fetched from the newly created Podman environment. It is reproducible.
No I am saying your path is different from the one in the old issue #11732, you have a extra root/build-test/test2
in there
Can you try with the full path to the directory, e.g. podman -r build -t test2 /path/to/link
OK, I understand. I was able to build it by specifying the path.
# podman -r build -t test2 /root/build-test/test2
STEP 1/2: FROM registry.access.redhat.com/ubi8/ubi
STEP 2/2: RUN uname -a
Linux b20a3e8238f9 5.14.18-300.fc35.x86_64 #1 SMP Fri Nov 12 16:43:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
COMMIT test2
--> a27bd92387e
Successfully tagged localhost/test2:latest
a27bd92387e278cbf840d9c7c3e4af69eda5cca00573c9d1e49441d50e12d83c
The Linux version of podman-remote seems to be fine.
Only if the server side has files in the same path as the client side.
On macOS, the error continues.
$ sw_vers
ProductName: macOS
ProductVersion: 11.6.1
BuildVersion: 20G224
$ ls -l /tmp
lrwxr-xr-x@ 1 root wheel 11 1 1 2020 /tmp -> private/tmp
$ tree /tmp/test
/tmp/test
└── Containerfile
0 directories, 1 file
$ podman version
Client:
Version: 4.0.0-dev
API Version: 4.0.0-dev
Go Version: go1.17.2
Git Commit: ed83ef2517ba4d6a0c7659206fe3a2faa0bdf547
Built: Tue Nov 23 04:29:35 2021
OS/Arch: darwin/amd64
Server:
Version: 4.0.0-dev
API Version: 4.0.0-dev
Go Version: go1.16.8
Git Commit: 7324d94648a9987b0de2dc95cf1b6fbc20592532
Built: Fri Nov 26 02:13:03 2021
OS/Arch: linux/amd64
$ podman build -t from-mac /tmp/test/
Error: stat /var/tmp/libpod_builder009900604/build/tmp/test/Containerfile: no such file or directory
$ podman build -t from-mac /private/tmp/test/
STEP 1/2: FROM registry.access.redhat.com/ubi8/ubi
STEP 2/2: RUN uname -a
Linux b20a3e8238f9 5.14.18-300.fc35.x86_64 #1 SMP Fri Nov 12 16:43:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
COMMIT from-mac
--> 5b99ea27313
Successfully tagged localhost/from-mac:latest
5b99ea27313b9ab2f8af67e89e5a4cb482114dcced6df6b15c33b463ecf63e7c
The following code solved the problem. This works not only for macOS, but also for podman-remote on Linux
$ git diff pkg/bindings/images/build.go
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 3b0bebe9f..6e636aa7c 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -345,6 +345,13 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
c = tmpFile.Name()
}
+
+ cfDir := filepath.Dir(c)
+ if absDir, err := filepath.EvalSymlinks(cfDir); err == nil {
+ name := filepath.ToSlash(strings.TrimPrefix(c, cfDir+string(filepath.Separator)))
+ c = filepath.Join(absDir,name)
+ }
+
containerfile, err := filepath.Abs(c)
if err != nil {
logrus.Errorf("Cannot find absolute path of %v: %v", c, err)
Description
When building with podman-remote, an error occurs if the context directory is symlink.
Steps to reproduce the issue:
If the context directory is symlink.
If the context directory is a real directory.
Additional notes: I reproduced the same error on macOS remote client(v3.4.2 and latest main branch). This error will block the execution of "Clone Repository in Container Volume" in VS Code on macOS. It works fine when using Docker.
Output of
podman version
if reporting apodman build
issue:*Output of `cat /etc/release`:**
Output of
uname -a
:Output of
cat /etc/containers/storage.conf
: