Last active
July 17, 2025 12:50
-
-
Save tsuchm/57e74ea888d0b1b24f99cf8211c279e8 to your computer and use it in GitHub Desktop.
Convert a docker container image distributed at DockerHub for singularity without installing singularity (but requires Docker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM amd64/debian:unstable | |
# disallow services to run for package installation | |
RUN echo "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d | |
# upgrade already-installed packages | |
RUN apt update && \ | |
DEBIAN_FRONTEND=noninteractive apt -y dist-upgrade && \ | |
DEBIAN_FRONTEND=noninteractive apt install -y singularity-container | |
# remove apt-related temporary files | |
RUN apt clean && rm -rf /var/lib/apt/lists/* | |
# allow services to run | |
RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- Makefile -*- | |
SOURCE=docker://rocm/pytorch:rocm6.4.1_ubuntu24.04_py3.12_pytorch_release_2.7.1 | |
TARGET=rocm-pytorch.sif | |
DOCKERNAME=debian-unstable-singularity | |
$(TARGET): $(DOCKERNAME) | |
docker run --name $(DOCKERNAME) -v `pwd`:/output --privileged \ | |
$(DOCKERNAME) singularity pull /output/$(TARGET) $(SOURCE) | |
docker rm $(DOCKERNAME) | |
$(DOCKERNAME): Dockerfile | |
docker build -f Dockerfile -t $(DOCKERNAME) . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment