Skip to content

Conversation

Alexhuszagh
Copy link
Contributor

Currently, docker detection fails under a few cases:

  1. If podman_docker is installed, so the filename is docker but the actual executable is podman.
  2. If the executable has a suffix, such as .exe on Windows, because we check if the executable ends_with(DOCKER).

The only reliable way to fix both these issues, IE, if the actual engine is docker and not an alias, and if the executable does not contain a suffix, is to query the container engine. This might not be ideal for performance reasons, but is the only reliable way to fix these issues.

Closes #530.
Closes #538.

@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 4, 2022 16:19
let runner = config.runner(target)?;

let mut docker = docker_command("run")?;
let is_docker = get_is_docker(get_container_engine().unwrap(), verbose)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this can't fail due to the above command: docker_command ensures that get_container_engine is not an error.

@Alexhuszagh Alexhuszagh added no changelog A valid PR without changelog (no-changelog) bug A-container-engine Area: container engines labels Jun 4, 2022
Currently, docker detection fails under a few cases:
1. If `podman_docker` is installed, so the filename is docker but the
actual executable is podman. 2. If the executable has a suffix, such as `.exe` on Windows, because we check if the executable `ends_with(DOCKER)`.

The only reliable way to fix both these issues, IE, if the actual engine is docker and not an alias, and if the executable does not contain a suffix, is to query the container engine. This might not be ideal for performance reasons, but is the only reliable way to fix these issues.

Emulated docker will have an output of `Emulate Docker CLI using podman.`, while docker itself will have an output similar to `Docker version 20.10.16, build aa7e414`.

Closes cross-rs#530.
Closes cross-rs#538.
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 5, 2022

Build succeeded:

@bors bors bot merged commit 6a7fa09 into cross-rs:main Jun 5, 2022
@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-container-engine Area: container engines bug no changelog A valid PR without changelog (no-changelog)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure when podman-docker is installed
2 participants