Skip to content

Commit

Permalink
fix/installer docker desktop host path
Browse files Browse the repository at this point in the history
  • Loading branch information
anonkey committed Feb 1, 2024
1 parent 40c1634 commit 61edbf1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/nanocl/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ pub async fn exec_install(args: &InstallOpts) -> IoResult<()> {
} else {
None
};
let docker_uds_host_path =
if is_docker_desktop && docker_host.starts_with("unix://") {
Some("/var/run/docker.sock.raw".to_owned())

Check warning on line 85 in bin/nanocl/src/commands/install.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocl/src/commands/install.rs#L83-L85

Added lines #L83 - L85 were not covered by tests
} else {
docker_uds_path.clone()

Check warning on line 87 in bin/nanocl/src/commands/install.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocl/src/commands/install.rs#L87

Added line #L87 was not covered by tests
};
let nanocld_args = NanocldArg {
docker_host,
docker_uds_path,
docker_uds_host_path,

Check warning on line 92 in bin/nanocl/src/commands/install.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocl/src/commands/install.rs#L92

Added line #L92 was not covered by tests
state_dir,
conf_dir,
gateway,
Expand Down
3 changes: 3 additions & 0 deletions bin/nanocl/src/models/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ pub struct NanocldArg {
pub(crate) channel: String,
/// Specify if the docker host is unix socket
pub(crate) docker_uds_path: Option<String>,
/// Specify if the docker host is different on host
pub(crate) docker_uds_host_path: Option<String>,
}

/// Convert Nanocld to liquid::Object
Expand All @@ -84,6 +86,7 @@ impl From<NanocldArg> for liquid::Object {
"home_dir": arg.home_dir,
"channel": arg.channel,
"docker_uds_path": arg.docker_uds_path,
"docker_uds_host_path": arg.docker_uds_host_path,

Check warning on line 89 in bin/nanocl/src/models/install.rs

View check run for this annotation

Codecov / codecov/patch

bin/nanocl/src/models/install.rs#L89

Added line #L89 was not covered by tests
})
}
}
4 changes: 4 additions & 0 deletions installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,12 @@ Cargoes:
- /run/nanocl:/run/nanocl
# {% endif %}
# {% if docker_uds_path %}
# {% if docker_uds_host_path %}
- ${{ docker_uds_host_path }}:${{ docker_uds_path }}
# {% else %}
- ${{ docker_uds_path }}:${{ docker_uds_path }}
# {% endif %}
# {% endif %}
- ${{ state_dir }}:${{ state_dir }}
- ${{ conf_dir }}:${{ conf_dir }}

Expand Down

0 comments on commit 61edbf1

Please sign in to comment.