A custom Docker image to simulate an Ubuntu 18.04 SSH server in a container to be used as a Jenkins SSH agent or Ansible playbook target.
hadolint ./Dockerfile
docker build --tag holberton/mockssh ./
After building:
docker run --detach --name="mockssh-test" --privileged --volume /sys/fs/cgroup:/sys/fs/cgroup:ro --publish="22:22" holberton/mockssh \
&& sleep 2 \
&& docker cp mockssh-test:/home/ubuntu/.ssh/id_rsa ./id_rsa_mock `# Retrieve the private key of the container` \
&& chmod 0600 ./id_rsa_mock `# Set up correct authorization` \
&& ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ./id_rsa_mock ubuntu@localhost cat /etc/os-release `# Should print container properties with Ubuntu 18.04` \
&& docker rm -v -f "mockssh-test" && rm -f ./id_rsa_mock
Content type
Image
Digest
Size
722.1 MB
Last updated
about 5 years ago
docker pull holbertonschool/mockssh