Skip to content

Instantly share code, notes, and snippets.

@tsuchm
Last active July 17, 2025 12:50
Show Gist options
  • Save tsuchm/57e74ea888d0b1b24f99cf8211c279e8 to your computer and use it in GitHub Desktop.
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)
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
# -*- 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