Created
March 6, 2015 07:27
-
-
Save esamson/cc44e1124364004881b0 to your computer and use it in GitHub Desktop.
Dockerfile for a Vagrant ready image. Kinda works but getting permission denied errors in the synced folder (e.g., `/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
FROM centos:7 | |
RUN yum install -y openssh-server openssh-clients sudo | |
RUN yum clean all | |
RUN sed -ri 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config | |
RUN sed -i "s/Defaults requiretty.*/#Defaults requiretty/g" /etc/sudoers | |
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' | |
RUN ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N '' | |
RUN useradd vagrant | |
RUN echo 'vagrant:vagrant' | chpasswd | |
RUN echo 'root:vagrant' | chpasswd | |
ADD https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys | |
RUN chown -R vagrant:vagrant /home/vagrant/.ssh | |
RUN chmod -R go-rwx /home/vagrant/.ssh | |
RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | |
EXPOSE 22 |
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
Vagrant.configure(2) do |config| | |
config.vm.provider "docker" do |docker| | |
docker.build_dir = "." | |
docker.cmd = ["/usr/sbin/sshd", "-D"] | |
docker.has_ssh = true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment