Skip to content

fix: Podman compose incorrectly targets docker engine w/ compose - #386

Open
muchzill4 wants to merge 5 commits into
arm:mainfrom
muchzill4:local-podman-compose-socket
Open

fix: Podman compose incorrectly targets docker engine w/ compose#386
muchzill4 wants to merge 5 commits into
arm:mainfrom
muchzill4:local-podman-compose-socket

Conversation

@muchzill4

@muchzill4 muchzill4 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Changes

ℹ️ This seems to affect podman 4.9.x, which is the version ubuntu 24.04 LTS ship with, my local tests with brewed podman 6.0.0 did work as expected w/o explicit DOCKER_HOST being set

  • Configure the docker-compose provider with Podman’s resolved local API endpoint via DOCKER_HOST.
  • Keep raw Podman commands on their normal local configuration; use CONTAINER_HOST only for explicit sockets.
  • Correct deployment assertions to query containers with raw Podman rather than Compose, preventing tests from checking Docker while Podman Compose was misconfigured.
    • See the CI failure from the first commit of this PR
  • Cache the resolved local Compose endpoint

Checklist

  • 🤖 This change is covered by tests as required.
  • 🤹 All required manual testing has been performed.
  • 📖 All documentation updates are complete.

Signed-off-by: Bartek Mucha <bartosz.mucha@arm.com>
Signed-off-by: Bartek Mucha <bartosz.mucha@arm.com>
Signed-off-by: Bartek Mucha <bartosz.mucha@arm.com>
Signed-off-by: Bartek Mucha <bartosz.mucha@arm.com>
Signed-off-by: Bartek Mucha <bartosz.mucha@arm.com>
@muchzill4
muchzill4 marked this pull request as ready for review July 31, 2026 12:54
@muchzill4
muchzill4 requested a review from a team as a code owner July 31, 2026 12:54
@muchzill4 muchzill4 changed the title fix: Use podman socket for compose commands fix: Support podman <5.x.x for compose commands Jul 31, 2026
@muchzill4 muchzill4 changed the title fix: Support podman <5.x.x for compose commands fix: Podman compose incorrectly targets docker engine w/ compose Jul 31, 2026

@th3james th3james left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally looks OK, but there are a few tweaks to consider

Comment thread .github/workflows/ci.yaml
Comment on lines +145 to +149
runtime_dir="$RUNNER_TEMP/podman-runtime"
mkdir -p "$runtime_dir/podman"
chmod 700 "$runtime_dir"
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
export XDG_RUNTIME_DIR="$runtime_dir"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overwriting this seems a touch invasive and could let to subtle misbehaviour. Possible that I'm being paranoid, but is it worth respecting the existing value?

Suggested change
runtime_dir="$RUNNER_TEMP/podman-runtime"
mkdir -p "$runtime_dir/podman"
chmod 700 "$runtime_dir"
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
export XDG_RUNTIME_DIR="$runtime_dir"
runtime_dir="${XDG_RUNTIME_DIR:-$RUNNER_TEMP/podman-runtime}"
mkdir -p "$runtime_dir/podman"
if [ -z "${XDG_RUNTIME_DIR:-}" ]; then
chmod 700 "$runtime_dir"
echo "XDG_RUNTIME_DIR=$runtime_dir" >> "$GITHUB_ENV"
export XDG_RUNTIME_DIR="$runtime_dir"
fi

Comment on lines +39 to +58
func (socket Socket) ConfigureComposeEnv(environment []string) ([]string, error) {
if socket.localComposeSocket == nil {
return append(environment, "DOCKER_HOST="+socket.url), nil
}
return socket.localComposeSocket.ConfigureEnv(environment)
}

func (socket *localComposeSocket) ConfigureEnv(environment []string) ([]string, error) {
socket.mutex.Lock()
defer socket.mutex.Unlock()

if socket.url == "" {
url, err := ResolveLocalComposeSocket(context.Background())
if err != nil {
return nil, err
}
socket.url = url
}
return append(environment, "DOCKER_HOST="+socket.url), nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found this quite hard to follow, I think it's clearer if we separate out "get the URL from a Socket" from "change the ENV"

Suggested change
func (socket Socket) ConfigureComposeEnv(environment []string) ([]string, error) {
if socket.localComposeSocket == nil {
return append(environment, "DOCKER_HOST="+socket.url), nil
}
return socket.localComposeSocket.ConfigureEnv(environment)
}
func (socket *localComposeSocket) ConfigureEnv(environment []string) ([]string, error) {
socket.mutex.Lock()
defer socket.mutex.Unlock()
if socket.url == "" {
url, err := ResolveLocalComposeSocket(context.Background())
if err != nil {
return nil, err
}
socket.url = url
}
return append(environment, "DOCKER_HOST="+socket.url), nil
}
func (socket Socket) ConfigureComposeEnv(environment []string) ([]string, error) {
socketURL, err := socket.GetSocketURL()
if err != nil {
return nil, err
}
return append(environment, "DOCKER_HOST="+socketURL), nil
}
func (socket Socket) GetSocketURL() (string, error) {
if socket.localComposeSocket != nil {
return socket.localComposeSocket.GetSocketURL()
}
if socket.url == "" {
return "", errors.New("podman socket URL not configured")
}
return socket.url, nil
}
func (socket *localComposeSocket) GetSocketURL() (string, error) {
socket.mutex.Lock()
defer socket.mutex.Unlock()
if socket.url == "" {
url, err := ResolveLocalComposeSocket(context.Background())
if err != nil {
return "", err
}
socket.url = url
}
return socket.url, nil
}


// ResolveLocalComposeSocket returns the host-accessible Podman API endpoint
// that the external Compose provider must use for a local deployment.
func ResolveLocalComposeSocket(ctx context.Context) (string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on the public interface and it takes a context, but it has a single call site inside this package , and the only context it gets passed is context.Background().
Should we consider either removing the ability to pass a context, or update the function APIs up the call stack to allow passing the existing context down?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants