| 1 |
# syntax=docker/dockerfile:1 |
| 2 |
|
| 3 |
# ENGINE_VERSION is the version of the (docker-in-docker) Docker Engine to |
| 4 |
# test against. |
| 5 |
ARG ENGINE_VERSION=28 |
| 6 |
|
| 7 |
FROM docker:${ENGINE_VERSION}-dind |
| 8 |
|
| 9 |
# the openssh-client update is needed for security reasons when using docker:23.0-dind, currently maintained as an lts by mirantis |
| 10 |
RUN apk --no-cache add openssl openssh-client openssh-server shadow && \ |
| 11 |
apk --no-cache upgrade openssl openssh-client openssh-server && \ |
| 12 |
# TODO(krissetto): `groupadd` can be removed once we only test against moby >= v24 |
| 13 |
# see https://github.com/docker-library/docker/pull/470 |
| 14 |
groupadd -f docker && \ |
| 15 |
useradd --create-home --shell /bin/sh --password $(head -c32 /dev/urandom | base64) penguin && \ |
| 16 |
usermod -aG docker penguin && \ |
| 17 |
ssh-keygen -A |
| 18 |
# workaround: ssh session excludes /usr/local/bin from $PATH |
| 19 |
RUN ln -s /usr/local/bin/docker /usr/bin/docker |
| 20 |
COPY ./connhelper-ssh/entrypoint.sh / |
| 21 |
EXPOSE 22 |
| 22 |
ENTRYPOINT ["/entrypoint.sh"] |
| 23 |
# usage: docker run --privileged -e TEST_CONNHELPER_SSH_ID_RSA_PUB=$(cat ~/.ssh/id_rsa.pub) -p 22 $THIS_IMAGE |