Created
October 28, 2017 17:30
-
-
Save caad1229/57b08b624a8d6402704103901957cd77 to your computer and use it in GitHub Desktop.
docker image for chef. before build add ssh pub key in build directory.
This file contains hidden or 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
| FROM ubuntu:16.04 | |
| RUN apt-get update | |
| RUN apt-get upgrade -y | |
| RUN apt-get install -y sudo vim git wget | |
| RUN apt-get install -y openssh-server | |
| #-------------------------------------- | |
| # chef | |
| #-------------------------------------- | |
| RUN apt-get install -y chef -y | |
| # please enable comment if you want to instal chef of latet version | |
| # RUN wget https://packages.chef.io/files/stable/chefdk/2.3.4/ubuntu/16.04/chefdk_2.3.4-1_amd64.deb | |
| # RUN dpkg -i chefdk_2.3.4-1_amd64.deb | |
| #-------------------------------------- | |
| # sshd | |
| #-------------------------------------- | |
| RUN mkdir -p /var/run/sshd | |
| RUN sed -ri 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config | |
| RUN mkdir -p /var/run/sshd && chmod 755 /var/run/sshd | |
| #------------------------------- | |
| # add user | |
| #------------------------------- | |
| RUN useradd -ms /bin/bash docker | |
| RUN echo docker:docker | chpasswd | |
| RUN echo 'docker ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| # regist pub key | |
| ADD id_rsa.pub /home/docker/.ssh/authorized_keys | |
| RUN chown -R docker.docker /home/docker/.ssh | |
| RUN chmod -R g-rwx,o-rwx /home/docker/.ssh | |
| CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment