# CentOS 6 Base Container FROM centos:6.7 # Install SSH RUN yum -y install openssh-server openssh-clients # Create postgres user and group RUN groupadd -g5000 postgres RUN adduser -gpostgres -u5000 -n postgres # Add Postgres packages RUN rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm # Create vagrant user RUN groupadd -g5001 admin RUN adduser -gadmin -u5001 -n vagrant # Install sudo and add admin to sudoers RUN yum -y install sudo RUN echo '%admin ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant RUN sed -i 's/^Defaults requiretty$/\# Defaults requiretty/' /etc/sudoers # Copy trusted SSH setup COPY ssh/config /root/resource/.ssh/config COPY ssh/id_rsa /root/resource/.ssh/id_rsa COPY ssh/id_rsa.pub /root/resource/.ssh/authorized_keys RUN chmod 700 /root/resource/.ssh RUN chmod 600 /root/resource/.ssh/* # Start SSH when container starts ENTRYPOINT service sshd restart && bash