Skip to content

Update script to detect Podman in the system #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions script/get-docker/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ def preprocess(i):

recursion_spaces = i['recursion_spaces']

file_name = 'docker.exe' if os_info['platform'] == 'windows' else 'docker'
env['FILE_NAME'] = file_name
file_name_docker = 'docker.exe' if os_info['platform'] == 'windows' else 'docker'
file_name_podman = 'podman.exe' if os_info['platform'] == 'windows' else 'podman'

if 'MLC_DOCKER_BIN_WITH_PATH' not in env:
r = i['automation'].find_artifact({'file_name': file_name,
# check for docker
# if docker is not found, podman is checked
env['FILE_NAME'] = file_name_docker
env['CONTAINER_TOOL_NAME'] = "docker"
r = i['automation'].find_artifact({'file_name': file_name_docker,
'env': env,
'os_info': os_info,
'default_path_env_key': 'PATH',
Expand All @@ -26,11 +30,26 @@ def preprocess(i):
'recursion_spaces': recursion_spaces})
if r['return'] > 0:
if r['return'] == 16:
run_file_name = "install"
r = automation.run_native_script(
{'run_script_input': i['run_script_input'], 'env': env, 'script_name': run_file_name})
# check for podman
# if podman is also absent, the script will try to
# automatically install docker in the system
env['FILE_NAME'] = file_name_podman
env['CONTAINER_TOOL_NAME'] = "podman"
r = i['automation'].find_artifact({'file_name': file_name_podman,
'env': env,
'os_info': os_info,
'default_path_env_key': 'PATH',
'detect_version': True,
'env_path_key': 'MLC_DOCKER_BIN_WITH_PATH',
'run_script_input': i['run_script_input'],
'recursion_spaces': recursion_spaces})
if r['return'] > 0:
return r
if r['return'] == 16:
run_file_name = "install"
r = automation.run_native_script(
{'run_script_input': i['run_script_input'], 'env': env, 'script_name': run_file_name})
if r['return'] > 0:
return r
else:
return r

Expand Down
2 changes: 1 addition & 1 deletion script/get-docker/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
docker --version > tmp-ver.out
${CONTAINER_TOOL_NAME} --version > tmp-ver.out
test $? -eq 0 || exit 1
Loading