Skip to content
Snippets Groups Projects
Unverified Commit ccc07feb authored by André Silva's avatar André Silva Committed by GitHub
Browse files

fix(docker): don't use docker command if using podman (#212)

parent cd5c765f
Branches
No related merge requests found
Pipeline #474667 passed with stage
in 12 minutes and 16 seconds
......@@ -208,8 +208,13 @@ impl DockerClient {
}
impl DockerClient {
fn client_command(&self) -> tokio::process::Command {
tokio::process::Command::new(self.client_binary())
}
pub async fn create_volume(&self, name: &str) -> Result<()> {
let result = tokio::process::Command::new("docker")
let result = self
.client_command()
.args(["volume", "create", name])
.output()
.await
......@@ -227,7 +232,7 @@ impl DockerClient {
}
pub async fn container_run(&self, options: ContainerRunOptions) -> Result<String> {
let mut cmd = tokio::process::Command::new("docker");
let mut cmd = self.client_command();
cmd.args(["run", "-d", "--platform", "linux/amd64"]);
Self::apply_cmd_options(&mut cmd, &options);
......@@ -256,7 +261,7 @@ impl DockerClient {
}
pub async fn container_create(&self, options: ContainerRunOptions) -> Result<String> {
let mut cmd = tokio::process::Command::new("docker");
let mut cmd = self.client_command();
cmd.args(["container", "create"]);
Self::apply_cmd_options(&mut cmd, &options);
......@@ -294,7 +299,7 @@ impl DockerClient {
where
S: Into<String> + std::fmt::Debug + Send + Clone,
{
let mut cmd = tokio::process::Command::new("docker");
let mut cmd = self.client_command();
cmd.arg("exec");
if let Some(env) = env {
......@@ -346,7 +351,8 @@ impl DockerClient {
local_path: &Path,
remote_path: &Path,
) -> Result<()> {
let result = tokio::process::Command::new("docker")
let result = self
.client_command()
.args([
"cp",
local_path.to_string_lossy().as_ref(),
......@@ -374,7 +380,8 @@ impl DockerClient {
}
pub async fn container_rm(&self, name: &str) -> Result<()> {
let result = tokio::process::Command::new("docker")
let result = self
.client_command()
.args(["rm", "--force", "--volumes", name])
.output()
.await
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment