summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason T. Greene <jason.greene@redhat.com>2022-04-06 23:03:48 -0500
committerJason T. Greene <jason.greene@redhat.com>2022-04-06 23:06:57 -0500
commit356d5343445133f4071566a54f7b82a1e7eb9689 (patch)
treed8cf7904a7c7360eb0fb2e3f8b8fcb0cd64220ee
parent6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc (diff)
downloadpodman-356d5343445133f4071566a54f7b82a1e7eb9689.tar.gz
podman-356d5343445133f4071566a54f7b82a1e7eb9689.tar.bz2
podman-356d5343445133f4071566a54f7b82a1e7eb9689.zip
Fix docker socket handling
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
-rw-r--r--pkg/machine/qemu/machine.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 5d1ba511c..be31d513b 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -1120,11 +1120,16 @@ func (v *MachineVM) setupAPIForwarding(cmd []string) ([]string, string, apiForwa
cmd = append(cmd, []string{"-forward-dest", destSock}...)
cmd = append(cmd, []string{"-forward-user", forwardUser}...)
cmd = append(cmd, []string{"-forward-identity", v.IdentityPath}...)
- link := socket.GetPath()
// The linking pattern is /var/run/docker.sock -> user global sock (link) -> machine sock (socket)
// This allows the helper to only have to maintain one constant target to the user, which can be
// repositioned without updating docker.sock.
+
+ link, err := v.userGlobalSocketLink()
+ if err != nil {
+ return cmd, socket.GetPath(), machineLocal
+ }
+
if !dockerClaimSupported() {
return cmd, socket.GetPath(), claimUnsupported
}
@@ -1163,6 +1168,16 @@ func (v *MachineVM) isIncompatible() bool {
return v.UID == -1
}
+func (v *MachineVM) userGlobalSocketLink() (string, error) {
+ path, err := machine.GetDataDir(v.Name)
+ if err != nil {
+ logrus.Errorf("Resolving data dir: %s", err.Error())
+ return "", err
+ }
+ // User global socket is located in parent directory of machine dirs (one per user)
+ return filepath.Join(filepath.Dir(path), "podman.sock"), err
+}
+
func (v *MachineVM) forwardSocketPath() (*MachineFile, error) {
sockName := "podman.sock"
path, err := machine.GetDataDir(v.Name)