Last active
June 8, 2019 04:14
-
-
Save lgelfan/1ab1ceb6af34389b96ba9eb20f2220e1 to your computer and use it in GitHub Desktop.
docker-in-docker docker compose with sshd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Docker client with docker-compose && sshd | |
# | |
# use on a Docker host to allow you to ssh and access Docker and Compose remotely | |
# e.g., as part of CI/CD on a private network. | |
# ** Not for production use on publicly-exposed server ** | |
# | |
# mount for docker host socket: | |
# -v /var/run/docker.sock:/var/run/docker.sock:ro | |
# mount for docker-compose access (optional): | |
# -v /host/compose/root:/opt/compose/alias | |
# cd or reference -f /alias/to/docker-compose.yml file when using docker-compose ... | |
##### | |
FROM docker:17 | |
# (uses Alpine) | |
MAINTAINER @float | |
RUN apk add --update py-pip | |
RUN pip install docker-compose | |
# RUN apk add ca-certificates curl openssl nano | |
RUN apk add openssh | |
# use fresh keys: (could also do on startup) | |
RUN rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key | |
RUN /usr/bin/ssh-keygen -A | |
# install (or append) to authorized_keys: (optional) | |
COPY certs/my-deploy.pub /root/.ssh/authorized_keys | |
# cleanup install: | |
RUN rm -rf /tmp/* /var/cache/apk/* | |
EXPOSE 22 | |
# remove prior entrypoint if there is one: | |
ENTRYPOINT [] | |
CMD ["/usr/sbin/sshd","-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment