When using Docker for computational purposes, you want to use singularity. However, since singularity cannot be built without sudo privileges, I asked podman in docker to work instead of everyone's working VM.
It's like Redhat's docker, and I think it's characterized by the lack of daemons.
When using it, ssh login to each VM and use it. Make the VM disposable and move files with scp etc.
FROM docker.io/library/docker:dind
RUN apk --update add \
bash \
py-pip \
supervisor \
openssh \
curl \
build-base \
libffi-dev \
&& \
rm -rf /var/cache/apk/*
RUN apk add python3-dev
RUN apk add --no-cache libressl-dev musl-dev libffi-dev
RUN pip install docker-compose
RUN mkdir -p /var/log/supervisor
RUN apk add --no-cache openssh openrc
RUN rc-update add sshd && rc-status
RUN mkdir -p /run/openrc/ && touch /run/openrc/softlevel
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
RUN ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add singularity
RUN sed -i '2s/^/bash -c "\/usr\/sbin\/sshd -D"\&\n/' /usr/local/bin/dockerd-entrypoint.sh
RUN apk add sudo
RUN echo -e "<password here>\n<password here>" | (adduser user -s /bin/bash)
RUN addgroup docker
RUN addgroup user docker
RUN addgroup user wheel
RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
#!/bin/bash
count=7000
for i in 0 1 2 3 4 5 6 7 8 9;
do
echo $i
sudo podman run -d --privileged -p 777$i:22 dind-docker
done
You can use it by creating an image on the container, creating a .sif file with singularity build, and moving it to your home with scp.
Recommended Posts