Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Last active August 29, 2015 14:15
Show Gist options
  • Save yuuichi-fujioka/c896643f649b3c5e1e68 to your computer and use it in GitHub Desktop.
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.
cp ~/.ssh/id_rsa.pub ./
docker build -t trusty_with_ssh ./
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
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