├── LICENSE ├── Makefile ├── README.md ├── alpine-3.4 └── Dockerfile ├── alpine-3.6 └── Dockerfile ├── alpine-3.7 └── Dockerfile ├── archlinux └── Dockerfile ├── bin └── retag_latest.sh ├── centos-6 └── Dockerfile ├── centos-7 └── Dockerfile ├── debian-7 └── Dockerfile ├── debian-8 └── Dockerfile ├── debian-9 └── Dockerfile ├── gentoo └── Dockerfile ├── opensuse-42.1 └── Dockerfile ├── opensuse-42.2 └── Dockerfile ├── opensuse-42.3 └── Dockerfile ├── ubuntu-14.04 └── Dockerfile ├── ubuntu-16.04 └── Dockerfile ├── ubuntu-18.04 └── Dockerfile └── ubuntu-20.04 └── Dockerfile /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Chu-Siang Lai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # ============================================================ 2 | # Author: Chu-Siang Lai / chusiang (at) drx.tw 3 | # Blog: http://note.drx.tw 4 | # Filename: Makefile 5 | # Modified: 2016-11-30 12:52 6 | # Description: Do something with make. 7 | # =========================================================== 8 | # 9 | .PHONY: main pull run start stop clean retag_latest 10 | 11 | main: run 12 | 13 | # Only download the docker image. 14 | pull: 15 | docker pull chusiang/ansible-managed-node:alpine-3.4 16 | docker pull chusiang/ansible-managed-node:centos-7 17 | docker pull chusiang/ansible-managed-node:debian-8 18 | docker pull chusiang/ansible-managed-node:ubuntu-14.04 19 | 20 | # Run containers. 21 | run: 22 | docker run --name managed-node-alpine-3.4 -d -P chusiang/ansible-managed-node:alpine-3.4 23 | docker run --name managed-node-ubuntu-14.04 -d -P chusiang/ansible-managed-node:ubuntu-14.04 24 | 25 | # Start containers. 26 | start: 27 | docker start managed-node-alpine-3.4 28 | docker start managed-node-ubuntu-14.04 29 | 30 | # Stop containers. 31 | stop: 32 | docker stop managed-node-alpine-3.4 33 | docker stop managed-node-ubuntu-14.04 34 | 35 | # Remove containers. 36 | clean: 37 | docker rm -f managed-node-alpine-3.4 managed-node-ubuntu-14.04 38 | 39 | # Retag and push the latest tag. 40 | retag_latest: 41 | -sh bin/retag_latest.sh 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker image: Ansible Managed Node 2 | 3 | [![Docker Hub](https://img.shields.io/badge/docker-ansible--managed--node-blue.svg)](https://hub.docker.com/r/chusiang/ansible-managed-node/) [![microbadger](https://images.microbadger.com/badges/image/chusiang/ansible-managed-node.svg)](https://microbadger.com/images/chusiang/ansible-managed-node "Get your own image badge on microbadger.com") 4 | 5 | A Docker image of run the [OpenSSH][openssh_official] daemon and [Python][python_official] for [Ansible][ansible_offical]. 6 | 7 | > WARNING: This docker image can be access with ssh by [*chusiang/ansible-jupyter*][ansible_jupyter] image. Do not use it on the Production Environment, please. 8 | 9 | ## Supported tags and respective `Dockerfile` links 10 | 11 | - ~~`alpine-3.4`~~ [*(alpine-3.4/Dockerfile)*][dockerfile_alpine-3.4] 12 | - `alpine-3.6` [*(alpine-3.6/Dockerfile)*][dockerfile_alpine-3.6] 13 | - `alpine-3.7`, `latest` [*(alpine-3.7/Dockerfile)*][dockerfile_alpine-3.7] 14 | - `archlinux` [*(archlinux/Dockerfile)*][dockerfile_archlinux] 15 | - `centos-6` [*(centos-7/Dockerfile)*][dockerfile_centos-6] 16 | - `centos-7` [*(centos-7/Dockerfile)*][dockerfile_centos-7] 17 | - ~~`debian-7`~~ [*(debian-7/Dockerfile)*][dockerfile_debian-7] 18 | - `debian-8` [*(debian-8/Dockerfile)*][dockerfile_debian-8] 19 | - `debian-9` [*(debian-9/Dockerfile)*][dockerfile_debian-9] 20 | - ~~`gentoo`~~ [*(gentoo/Dockerfile)*][dockerfile_gentoo] 21 | - ~~`opensuse-42.1`~~ [*(opensuse-42.1/Dockerfile)*][dockerfile_opensuse-42.1] 22 | - `opensuse-42.2` [*(opensuse-42.2/Dockerfile)*][dockerfile_opensuse-42.2] 23 | - `opensuse-42.3` [*(opensuse-42.3/Dockerfile)*][dockerfile_opensuse-42.3] 24 | - ~~`ubuntu-14.04`~~ [*(ubuntu-14.04/Dockerfile)*][dockerfile_ubuntu-14.04] 25 | - `ubuntu-16.04` [*(ubuntu-16.04/Dockerfile)*][dockerfile_ubuntu-16.04] 26 | - `ubuntu-18.04` [*(ubuntu-18.04/Dockerfile)*][dockerfile_ubuntu-18.04] 27 | 28 | [dockerfile_alpine-3.4]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/alpine-3.4/Dockerfile 29 | [dockerfile_alpine-3.6]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/alpine-3.6/Dockerfile 30 | [dockerfile_alpine-3.7]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/alpine-3.7/Dockerfile 31 | [dockerfile_archlinux]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/archlinux/Dockerfile 32 | [dockerfile_centos-6]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/centos-6/Dockerfile 33 | [dockerfile_centos-7]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/centos-7/Dockerfile 34 | [dockerfile_debian-7]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/debian-7/Dockerfile 35 | [dockerfile_debian-8]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/debian-8/Dockerfile 36 | [dockerfile_debian-9]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/debian-9/Dockerfile 37 | [dockerfile_gentoo]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/gentoo/Dockerfile 38 | [dockerfile_opensuse-42.1]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/opensuse-42.1/Dockerfile 39 | [dockerfile_opensuse-42.2]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/opensuse-42.2/Dockerfile 40 | [dockerfile_opensuse-42.3]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/opensuse-42.3/Dockerfile 41 | [dockerfile_ubuntu-14.04]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/ubuntu-14.04/Dockerfile 42 | [dockerfile_ubuntu-16.04]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/ubuntu-16.04/Dockerfile 43 | [dockerfile_ubuntu-18.04]: https://github.com/chusiang/ansible-managed-node.dockerfile/blob/master/ubuntu-18.04/Dockerfile 44 | 45 | ## Account 46 | 47 | **root** user: 48 | 49 | - username: `root` 50 | - password: `root` 51 | 52 | **sudo** user: 53 | 54 | - username: `docker` 55 | - password: `docker` 56 | 57 | [openssh_official]: https://www.openssh.com/ 58 | [ansible_offical]: https://www.ansible.com/ 59 | [python_official]: https://www.python.org/ 60 | [ansible_jupyter]: https://hub.docker.com/r/chusiang/ansible-jupyter/ 61 | 62 | ## Build image 63 | 64 | 1. Get this project. 65 | 66 | ``` 67 | $ git clone https://github.com/chusiang/ansible-managed-node.dockerfile.git 68 | ``` 69 | 70 | 1. Go to workspace. 71 | 72 | ``` 73 | $ cd ansible-managed-node.dockerfile/ 74 | ``` 75 | 76 | 1. Bunild the image. 77 | 78 | ``` 79 | $ docker build -t chusiang/ansible-managed-node . 80 | ``` 81 | 82 | ## Run container 83 | 84 | 1. Get image. 85 | 86 | ``` 87 | $ docker pull chusiang/ansible-managed-node 88 | ``` 89 | 90 | 1. Run the container with daemon mode. 91 | 92 | ``` 93 | $ docker run --name ansible-managed-node -P -d chusiang/ansible-managed-node 94 | be8a15b9d4da5d24610c1fc738cb13086f01101e90f94640360d8d84892de772 95 | ``` 96 | 97 | 1. Check container process. 98 | 99 | ``` 100 | $ docker ps 101 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 102 | be8a15b9d4da chusiang/ansible-managed-node "/usr/sbin/sshd -D" 9 minutes ago Up 9 minutes 0.0.0.0:32777->22/tcp ansible-managed-node 103 | ``` 104 | 105 | 1. Enter container with command line. 106 | 107 | ``` 108 | $ docker exec -it ansible-managed-node bash 109 | bash-4.3# 110 | ``` 111 | 112 | Enjoy it ! 113 | 114 | ## History 115 | 116 | ### 2018 117 | 118 | * 06/18 Add new images of `alpine-3.7`, `ubuntu-18.04`, enable the **sudo no password** in each images. Stop automated build images of `alpine-3.4`, `debian-7`, `ubuntu-14.04`. 119 | 120 | ## License 121 | 122 | Copyright (c) chusiang from 2016-2017 under the MIT license. 123 | -------------------------------------------------------------------------------- /alpine-3.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apk update 7 | 8 | # Install the requires package. 9 | RUN apk add --no-cache openssh python sudo curl wget bash bash-completion 10 | 11 | # Setting the sshd. 12 | RUN mkdir /var/run/sshd 13 | RUN echo 'root:root' | chpasswd 14 | RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 15 | 16 | # Generate the ssh host keys. 17 | RUN ssh-keygen -A 18 | 19 | ENV NOTVISIBLE "in users profile" 20 | RUN echo "export VISIBLE=now" >> /etc/profile 21 | 22 | # Create a new user. 23 | # 24 | # - username: docker 25 | # - password: docker 26 | RUN adduser -s /bin/bash -D docker && \ 27 | echo 'docker:docker' | chpasswd 28 | 29 | # Add sudo permission. 30 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 31 | 32 | # Setting ssh public key. 33 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 34 | -O /tmp/authorized_keys && \ 35 | mkdir /home/docker/.ssh && \ 36 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 37 | chown -R docker:docker /home/docker/.ssh/ && \ 38 | chmod 644 /home/docker/.ssh/authorized_keys && \ 39 | chmod 700 /home/docker/.ssh 40 | 41 | EXPOSE 22 42 | 43 | # Run ssh server daemon. 44 | CMD ["/usr/sbin/sshd", "-D"] 45 | 46 | -------------------------------------------------------------------------------- /alpine-3.6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.6 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apk update 7 | 8 | # Install the requires package. 9 | RUN apk add --no-cache openssh python sudo curl wget bash bash-completion 10 | 11 | # Setting the sshd. 12 | RUN mkdir /var/run/sshd 13 | RUN echo 'root:root' | chpasswd 14 | RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 15 | 16 | # Generate the ssh host keys. 17 | RUN ssh-keygen -A 18 | 19 | ENV NOTVISIBLE "in users profile" 20 | RUN echo "export VISIBLE=now" >> /etc/profile 21 | 22 | # Create a new user. 23 | # 24 | # - username: docker 25 | # - password: docker 26 | RUN adduser -s /bin/bash -D docker && \ 27 | echo 'docker:docker' | chpasswd 28 | 29 | # Add sudo permission. 30 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 31 | 32 | # Setting ssh public key. 33 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 34 | -O /tmp/authorized_keys && \ 35 | mkdir /home/docker/.ssh && \ 36 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 37 | chown -R docker:docker /home/docker/.ssh/ && \ 38 | chmod 644 /home/docker/.ssh/authorized_keys && \ 39 | chmod 700 /home/docker/.ssh 40 | 41 | EXPOSE 22 42 | 43 | # Run ssh server daemon. 44 | CMD ["/usr/sbin/sshd", "-D"] 45 | 46 | -------------------------------------------------------------------------------- /alpine-3.7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apk update 7 | 8 | # Install the requires package. 9 | RUN apk add --no-cache openssh python sudo curl wget bash bash-completion 10 | 11 | # Setting the sshd. 12 | RUN mkdir /var/run/sshd 13 | RUN echo 'root:root' | chpasswd 14 | RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 15 | 16 | # Generate the ssh host keys. 17 | RUN ssh-keygen -A 18 | 19 | ENV NOTVISIBLE "in users profile" 20 | RUN echo "export VISIBLE=now" >> /etc/profile 21 | 22 | # Create a new user. 23 | # 24 | # - username: docker 25 | # - password: docker 26 | RUN adduser -s /bin/bash -D docker && \ 27 | echo 'docker:docker' | chpasswd 28 | 29 | # Add sudo permission. 30 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 31 | 32 | # Setting ssh public key. 33 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 34 | -O /tmp/authorized_keys && \ 35 | mkdir /home/docker/.ssh && \ 36 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 37 | chown -R docker:docker /home/docker/.ssh/ && \ 38 | chmod 644 /home/docker/.ssh/authorized_keys && \ 39 | chmod 700 /home/docker/.ssh 40 | 41 | EXPOSE 22 42 | 43 | # Run ssh server daemon. 44 | CMD ["/usr/sbin/sshd", "-D"] 45 | 46 | -------------------------------------------------------------------------------- /archlinux/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM finalduty/archlinux:daily 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Upgrade the currently installed packages. 6 | RUN pacman -Syu --noconfirm 7 | 8 | # Install the requires package. 9 | RUN pacman -S --noconfirm openssh python sudo curl wget bash-completion openssl \ 10 | && \ 11 | pacman -Scc --noconfirm 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -A 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:docker /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /bin/retag_latest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DOCKER_IMAGE="chusiang/ansible-managed-node" 4 | DOCKER_TAG="alpine-3.6" 5 | 6 | echo '===> Pull current image ...' 7 | docker pull $DOCKER_IMAGE:$DOCKER_TAG 8 | echo 9 | 10 | echo '===> Tag current image to latest ...' 11 | docker tag $DOCKER_IMAGE:$DOCKER_TAG $DOCKER_IMAGE:latest 12 | echo 13 | 14 | echo '===> Push the latest tag ...' 15 | docker push $DOCKER_IMAGE:latest 16 | echo 17 | 18 | echo '===> Remove old image ...' 19 | docker rmi $(docker images | grep $DOCKER_IMAGE | grep '' | awk '{ print $3 }') 20 | -------------------------------------------------------------------------------- /centos-6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN yum update -y 7 | 8 | # Install the requires package. 9 | RUN yum install -y openssh-server openssh-clients python sudo curl wget bash-completion openssl \ 10 | && \ 11 | yum clean all 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | #RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:docker /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /centos-7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN yum update -y 7 | 8 | # Install the requires package. 9 | RUN yum install -y openssh-server openssh-clients python sudo curl wget bash-completion openssl \ 10 | && \ 11 | yum clean all 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | #RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -A 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:docker /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /debian-7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:7 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo openssl curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /debian-8/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:8 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo openssl curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /debian-9/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:9 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo openssl curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /gentoo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gentoo/stage3-amd64 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN emerge --sync 7 | 8 | # Install the requires portage package and python. 9 | RUN emerge python:2.7 dev-python/pip sudo net-misc/curl wget bash-completion gentoolkit 10 | 11 | # switch python to v2.7. 12 | RUN eselect python set 1 13 | 14 | # Upgrade the pip to lastest. 15 | RUN pip install -U pip 16 | 17 | # Setup the ansible. 18 | RUN pip install ansible 19 | 20 | # for disable localhost warning message. 21 | RUN mkdir /etc/ansible && \ 22 | /bin/echo -e "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts 23 | 24 | # install openssh with ansible. 25 | RUN ansible localhost -m portage -a 'package=openssh state=present' -vvvv 26 | 27 | # Setting the sshd. 28 | RUN mkdir /var/run/sshd 29 | RUN echo 'root:root' | chpasswd 30 | RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 31 | 32 | # Generate the ssh host keys. 33 | RUN ssh-keygen -A 34 | 35 | # SSH login fix. Otherwise user is kicked off after login 36 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 37 | 38 | ENV NOTVISIBLE "in users profile" 39 | RUN echo "export VISIBLE=now" >> /etc/profile 40 | 41 | # Create a new user. 42 | # 43 | # - username: docker 44 | # - password: docker 45 | RUN useradd --create-home --shell /bin/bash \ 46 | --password $(openssl passwd -1 docker) docker 47 | 48 | # Add sudo permission. 49 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 50 | 51 | # Setting ssh public key. 52 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 53 | -O /tmp/authorized_keys && \ 54 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 55 | chown -R docker:docker /home/docker/.ssh/ && \ 56 | chmod 644 /home/docker/.ssh/authorized_keys && \ 57 | chmod 700 /home/docker/.ssh 58 | 59 | EXPOSE 22 60 | 61 | # Run ssh server daemon. 62 | CMD ["/usr/sbin/sshd", "-D"] 63 | 64 | -------------------------------------------------------------------------------- /opensuse-42.1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opensuse:42.1 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN zypper update -y 7 | 8 | # Install the requires package. 9 | RUN zypper -n install openssh python sudo curl wget bash-completion openssl \ 10 | && \ 11 | zypper clean -a 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -A 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:users /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /opensuse-42.2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opensuse:42.2 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN zypper update -y 7 | 8 | # Install the requires package. 9 | RUN zypper -n install openssh python sudo curl wget bash-completion openssl \ 10 | && \ 11 | zypper clean -a 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -A 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:users /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /opensuse-42.3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM opensuse:42.3 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN zypper update -y 7 | 8 | # Install the requires package. 9 | RUN zypper -n install openssh python sudo curl wget bash-completion openssl \ 10 | && \ 11 | zypper clean -a 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # Generate the ssh host keys. 19 | RUN ssh-keygen -A 20 | 21 | # SSH login fix. Otherwise user is kicked off after login 22 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 23 | 24 | ENV NOTVISIBLE "in users profile" 25 | RUN echo "export VISIBLE=now" >> /etc/profile 26 | 27 | # Create a new user. 28 | # 29 | # - username: docker 30 | # - password: docker 31 | RUN useradd --create-home --shell /bin/bash \ 32 | --password $(openssl passwd -1 docker) docker 33 | 34 | # Add sudo permission. 35 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 36 | 37 | # Setting ssh public key. 38 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 39 | -O /tmp/authorized_keys && \ 40 | mkdir /home/docker/.ssh && \ 41 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 42 | chown -R docker:users /home/docker/.ssh/ && \ 43 | chmod 644 /home/docker/.ssh/authorized_keys && \ 44 | chmod 700 /home/docker/.ssh 45 | 46 | EXPOSE 22 47 | 48 | # Run ssh server daemon. 49 | CMD ["/usr/sbin/sshd", "-D"] 50 | 51 | -------------------------------------------------------------------------------- /ubuntu-14.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /ubuntu-16.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /ubuntu-18.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | 48 | -------------------------------------------------------------------------------- /ubuntu-20.04/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | MAINTAINER Chu-Siang Lai 4 | 5 | # Update the index of available packages. 6 | RUN apt-get update 7 | 8 | # Install the requires package. 9 | RUN apt-get install -y openssh-server python sudo curl wget bash-completion openssl \ 10 | && \ 11 | apt-get clean 12 | 13 | # Setting the sshd. 14 | RUN mkdir /var/run/sshd 15 | RUN echo 'root:root' | chpasswd 16 | RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | 18 | # SSH login fix. Otherwise user is kicked off after login 19 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 20 | 21 | ENV NOTVISIBLE "in users profile" 22 | RUN echo "export VISIBLE=now" >> /etc/profile 23 | 24 | # Create a new user. 25 | # 26 | # - username: docker 27 | # - password: docker 28 | RUN useradd --create-home --shell /bin/bash \ 29 | --password $(openssl passwd -1 docker) docker 30 | 31 | # Add sudo permission. 32 | RUN echo 'docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 33 | 34 | # Setting ssh public key. 35 | RUN wget https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa.pub \ 36 | -O /tmp/authorized_keys && \ 37 | mkdir /home/docker/.ssh && \ 38 | mv /tmp/authorized_keys /home/docker/.ssh/ && \ 39 | chown -R docker:docker /home/docker/.ssh/ && \ 40 | chmod 644 /home/docker/.ssh/authorized_keys && \ 41 | chmod 700 /home/docker/.ssh 42 | 43 | EXPOSE 22 44 | 45 | # Run ssh server daemon. 46 | CMD ["/usr/sbin/sshd", "-D"] 47 | --------------------------------------------------------------------------------