Last active
August 29, 2015 14:02
-
-
Save bashtoni/406bfdfe678f99b1384d to your computer and use it in GitHub Desktop.
Create CentOS 6 docker container for use with Vagrant
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
# Docker image to use with Vagrant | |
# Aims to be as similar to normal Vagrant usage as possible | |
# Adds Puppet, SSH daemon | |
FROM centos | |
MAINTAINER Sam Bashton <[email protected]> | |
RUN yum -y install openssh-server | |
RUN yum -y install MAKEDEV | |
# Workaround needed for bad libselinux-ruby deps | |
RUN yum -y downgrade libselinux-2.0.94-5.3.el6_4.1 libselinux-utils | |
RUN yum -y localinstall https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm | |
RUN yum -y install puppet | |
# Generate SSH keys | |
RUN service sshd start | |
# Add vagrant user and key | |
RUN yum -y install sudo | |
RUN useradd --create-home -s /bin/bash vagrant | |
RUN echo -n 'vagrant:vagrant' | chpasswd | |
RUN echo 'vagrant ALL = NOPASSWD: ALL' > /etc/sudoers.d/vagrant | |
RUN chmod 440 /etc/sudoers.d/vagrant | |
RUN mkdir -p /home/vagrant/.ssh | |
RUN chmod 700 /home/vagrant/.ssh | |
RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys | |
RUN chmod 600 /home/vagrant/.ssh/authorized_keys | |
RUN chown -R vagrant:vagrant /home/vagrant/.ssh | |
RUN sed -i -e 's/Defaults.*requiretty/#&/' /etc/sudoers | |
RUN sed -i -e 's/\(UsePAM \)yes/\1 no/' /etc/ssh/sshd_config | |
CMD ["/usr/sbin/sshd", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment