Skip to content

Instantly share code, notes, and snippets.

@johndpope
Last active October 25, 2016 23:13
Show Gist options
  • Save johndpope/01a74ffb93921df48e334097117be1b3 to your computer and use it in GitHub Desktop.
Save johndpope/01a74ffb93921df48e334097117be1b3 to your computer and use it in GitHub Desktop.
Dockerfile for dev swift3 + ubuntu + sshd + zsh
FROM swiftdocker/swift
MAINTAINER John Pope <jp at fieldstormapp dot com>
# Set Environment Variables & Language Environment
ENV HOME /root
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update && apt-get -y install openssh-server supervisor unzip pkg-config
RUN mkdir /var/run/sshd
RUN echo 'root:alpine' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# for CGRPC building
RUN apt-get install -y build-essential autoconf libtool python-all-dev python-virtualenv zlib1g-dev libc++-dev libc++abi-dev
# Install Basic Packages
RUN apt-get install -y nano tmux colord zsh emacs
# RVM - Ruby Version Manager / bundler / Gemfiles
RUN curl -sSL https://get.rvm.io | bash
RUN source /etc/profile.d/rvm.sh
RUN rvm install ruby-2.2.3
RUN gem install rvm
#install ZSH
RUN git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& chsh -s /bin/zsh
RUN TERM=xterm-256color
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
EXPOSE 22
CMD ["/usr/bin/supervisord"]
# CMD ["zsh"]
# docker build -t swift3-ssh .
# https://github.com/swiftdocker/docker-swift/issues/9#issuecomment-162172540
# sudo docker run --security-opt seccomp=unconfined -p 2222:22 -i -t swift3-ssh
# docker ps # find container id
# docker exec -it <containerid> /usr/bin/zsh
[supervisord]
nodaemon=true
[program:sshd]
command=/usr/sbin/sshd -D
@johndpope
Copy link
Author

johndpope commented Oct 20, 2016

Use commands in comments to build image / start ssh / attach to container.
With UTF settings + ZSH - your linux console should look like this.
screen shot 2016-10-21 at 16 13 39

You can now connect via to 0.0.0.0:2222 with root + alpine password using Cyberduck

Edit files on host /osx - then drag and drop
screen shot 2016-10-20 at 18 04 41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment