Skip to content
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

[WIP] Docker-related fixes for v0.5.1 #503

Open
wants to merge 3 commits into
base: v0.5.1
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions monai/deploy/packager/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
COMMON_FOOTPRINT = """
USER root

RUN curl http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb -o libssl.deb && \\
dpkg -i libssl.deb && rm libssl.deb

RUN pip install --no-cache-dir --upgrade setuptools==59.5.0 pip==22.3 wheel==0.37.1 numpy>=1.21.6

RUN mkdir -p /etc/monai/ \\
Expand Down
2 changes: 1 addition & 1 deletion monai/deploy/packager/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def build_image(args: dict, temp_dir: str):
dockerignore_file.write(docker_ignore_template)

# Build dockerfile into an MAP image
docker_build_cmd = f"""docker build -f {docker_file_path!r} -t {tag} {temp_dir!r}"""
docker_build_cmd = f'''docker build -f "{docker_file_path}" -t {tag} "{temp_dir}"'''
if sys.platform != "win32":
docker_build_cmd += """ --build-arg MONAI_UID=$(id -u) --build-arg MONAI_GID=$(id -g)"""
if no_cache:
Expand Down
10 changes: 5 additions & 5 deletions monai/deploy/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def fetch_map_manifest(map_name: str) -> Tuple[dict, dict, int]:

with tempfile.TemporaryDirectory() as info_dir:
if sys.platform == "win32":
cmd = f'docker run --rm -a STDOUT -a STDERR -v " {info_dir}":/var/run/monai/export/config {map_name}'
cmd = f'docker run --rm -a STDOUT -a STDERR -v "{info_dir}":/var/run/monai/export/config {map_name}'
else:
cmd = f"""docker_id=$(docker create {map_name})
docker cp $docker_id:/etc/monai/app.json "{info_dir}/app.json"
Expand Down Expand Up @@ -89,7 +89,7 @@ def run_app(map_name: str, input_path: Path, output_path: Path, app_info: dict,
requested_gpus = get_requested_gpus(pkg_info)
if requested_gpus > 0:
if not has_rocm():
cmd = "nvidia-docker run --rm -a STDERR"
cmd = "docker run --rm --gpus all -a STDERR"

if not quiet:
cmd += " -a STDOUT"
Expand Down Expand Up @@ -163,11 +163,11 @@ def pkg_specific_dependency_verification(pkg_info: dict) -> bool:
requested_gpus = get_requested_gpus(pkg_info)
if requested_gpus > 0:
if not has_rocm():
# check for nvidia-docker
prog = "nvidia-docker"
# check for docker
prog = "docker"
logger.info('--> Verifying if "%s" is installed...\n', prog)
if not shutil.which(prog):
logger.error('ERROR: "%s" not installed, please install nvidia-docker.', prog)
logger.error('ERROR: "%s" not installed, please install docker.', prog)
return False

return True
Expand Down