podman compose: only trim path suffix when ssh protocol
For a unix socket we should not trim this at all. The problem exists for ssh only so make sure we only do this when a ssh URL is given. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
3cada04099
commit
d9aff9b41e
|
|
@ -132,10 +132,13 @@ func composeDockerHost() (string, error) {
|
|||
// If the default connection does not point to a `podman
|
||||
// machine`, we cannot use a local path and need to use SSH.
|
||||
if !conf.MachineMode {
|
||||
// Compose doesn't like paths, so we optimistically
|
||||
// Docker Compose v1 doesn't like paths for ssh, so we optimistically
|
||||
// assume the presence of a Docker socket on the remote
|
||||
// machine which is the case for podman machines.
|
||||
return strings.TrimSuffix(conf.URI, parsedConnection.Path), nil
|
||||
if parsedConnection.Scheme == "ssh" {
|
||||
return strings.TrimSuffix(conf.URI, parsedConnection.Path), nil
|
||||
}
|
||||
return conf.URI, nil
|
||||
}
|
||||
uri, err := getMachineConn(conf.URI, parsedConnection)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -55,10 +55,20 @@ EOF
|
|||
CONTAINERS_CONF_OVERRIDE=$compose_conf run_podman 42 compose fail
|
||||
|
||||
# Make sure the three env variables are set (and parsed)
|
||||
op='=~'
|
||||
url=".*/podman.sock"
|
||||
# if we run remote with --url check the url arg is honored
|
||||
if [[ "$PODMAN" =~ "--url" ]]; then
|
||||
# get the url from the podman string
|
||||
url="${PODMAN##*--url }"
|
||||
url="${url%% *}"
|
||||
op='='
|
||||
fi
|
||||
# podman-remote test might run with --url so unset this because the socket will be used otherwise
|
||||
CONTAINERS_CONF_OVERRIDE=$compose_conf run_podman compose env
|
||||
is "${lines[0]}" ".*/podman.sock"
|
||||
is "${lines[1]}" "0"
|
||||
is "${lines[2]}" ""
|
||||
assert "${lines[0]}" $op "$url" "line 1 of 3 (DOCKER_HOST)"
|
||||
assert "${lines[1]}" = "0" "line 2 of 3 (DOCKER_BUILDKIT)"
|
||||
assert "${lines[2]}" = "" "line 3 of 3 (DOCKER_CONFIG)"
|
||||
|
||||
DOCKER_HOST="$random_data" DOCKER_CONFIG="$random_data" CONTAINERS_CONF_OVERRIDE=$compose_conf run_podman compose env
|
||||
is "${lines[0]}" "$random_data"
|
||||
|
|
|
|||
Loading…
Reference in New Issue