|
| 1 | +FROM registry.fedoraproject.org/fedora:latest |
| 2 | + |
| 3 | +RUN dnf -y update; yum -y reinstall shadow-utils; \ |
| 4 | +yum -y install podman fuse-overlayfs openssh-server openssh-clients rsync git sudo curl --exclude container-selinux; \ |
| 5 | +rm -rf /var/cache /var/log/dnf* /var/log/yum.* |
| 6 | + |
| 7 | +RUN useradd podman; \ |
| 8 | +echo podman:10000:5000 > /etc/subuid; \ |
| 9 | +echo podman:10000:5000 > /etc/subgid; |
| 10 | + |
| 11 | +VOLUME /var/lib/containers |
| 12 | +VOLUME /home/podman/.local/share/containers |
| 13 | + |
| 14 | +RUN cat > /etc/containers/containers.conf <<'EOF' |
| 15 | +[containers] |
| 16 | +netns="host" |
| 17 | +userns="host" |
| 18 | +ipcns="host" |
| 19 | +utsns="host" |
| 20 | +cgroupns="host" |
| 21 | +cgroups="disabled" |
| 22 | +log_driver = "k8s-file" |
| 23 | +[engine] |
| 24 | +cgroup_manager = "cgroupfs" |
| 25 | +events_logger="file" |
| 26 | +runtime="crun" |
| 27 | +EOF |
| 28 | +RUN mkdir -p /home/podman/.config/containers/ |
| 29 | +RUN cat > /home/podman/.config/containers/containers.conf <<'EOF' |
| 30 | +[containers] |
| 31 | +volumes = [ |
| 32 | + "/proc:/proc", |
| 33 | +] |
| 34 | +default_sysctls = [] |
| 35 | +EOF |
| 36 | + |
| 37 | +RUN chown podman:podman -R /home/podman |
| 38 | + |
| 39 | +RUN chmod 644 /etc/containers/containers.conf |
| 40 | +#RUN sed -i -e 's|^#mount_program|mount_program|g' -e '/additionalimage.*/a "/var/lib/shared",' -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' /etc/containers/storage.conf |
| 41 | + |
| 42 | +RUN mkdir -p /var/lib/shared/overlay-images /var/lib/shared/overlay-layers /var/lib/shared/vfs-images /var/lib/shared/vfs-layers |
| 43 | +RUN touch /var/lib/shared/overlay-images/images.lock |
| 44 | +RUN touch /var/lib/shared/overlay-layers/layers.lock |
| 45 | +RUN touch /var/lib/shared/vfs-images/images.lock |
| 46 | +RUN touch /var/lib/shared/vfs-layers/layers.lock |
| 47 | + |
| 48 | +ENV _CONTAINERS_USERNS_CONFIGURED="" |
| 49 | + |
| 50 | +RUN mkdir -p /var/run/sshd |
| 51 | +#setup ssh for root user |
| 52 | +RUN (umask 077 && test -d /root/.ssh || mkdir /root/.ssh) |
| 53 | +RUN chmod 700 /root/.ssh |
| 54 | +RUN printf 'root:password' | chpasswd |
| 55 | +RUN ssh-keygen -A |
| 56 | +RUN sed -i 's/^#\{0,1\}PermitRootLogin.*$/PermitRootLogin yes/' /etc/ssh/sshd_config |
| 57 | +RUN sed -i 's/#AuthorizedKeysFile.*/AuthorizedKeysFile .ssh\/authorized_keys/g' /etc/ssh/sshd_config |
| 58 | +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd |
| 59 | +EXPOSE 22 |
| 60 | + |
| 61 | +#adding fish |
| 62 | +RUN dnf install -y fish |
| 63 | +RUN fish |
| 64 | +RUN chsh -s /usr/bin/fish |
| 65 | + |
| 66 | + |
| 67 | +ENTRYPOINT /usr/sbin/sshd -D |
| 68 | + |
0 commit comments