Last active
August 29, 2015 14:15
-
-
Save yuuichi-fujioka/c896643f649b3c5e1e68 to your computer and use it in GitHub Desktop.
run docker container as non container ubuntu.
this is verified on ubuntu trusty.
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
cp ~/.ssh/id_rsa.pub ./ | |
docker build -t trusty_with_ssh ./ |
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:trusty | |
MAINTAINER [email protected] | |
RUN apt-get install openssh-server -y | |
RUN useradd -d /home/ubuntu -m -s /bin/bash -U ubuntu | |
RUN adduser ubuntu sudo | |
RUN echo "ubuntu ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu | |
RUN mkdir /home/ubuntu/.ssh | |
ADD id_rsa.pub /home/ubuntu/.ssh/authorized_keys | |
RUN chown -R ubuntu:ubuntu /home/ubuntu |
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 run -d trusty_with_ssh /sbin/init --startup-event=failsafe-boot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment