Last active
February 17, 2019 08:01
-
-
Save bjornicus/66f03c93717590ae3e2694b759ef00db to your computer and use it in GitHub Desktop.
Docker Workstation with vs Code
This file contains 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
# based on https://github.com/mikadosoftware/workstation | |
FROM ubuntu:18.04 | |
RUN apt-get update && \ | |
apt-get install -y openssh-server \ | |
x11-apps | |
RUN mkdir -p /var/run/sshd | |
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config | |
RUN sed -ri 's/^#AllowTcpForwarding\s+.*/AllowTcpForwarding yes/g' /etc/ssh/sshd_config | |
RUN sed -ri 's/^#X11Forwarding\s+.*/X11Forwarding yes/g' /etc/ssh/sshd_config | |
RUN sed -ri 's/^#X11UseLocalhost\s+.*/X11UseLocalhost no/g' /etc/ssh/sshd_config | |
RUN apt-get install -y sudo | |
RUN adduser --disabled-password --gecos "" user | |
RUN usermod -aG sudo user | |
RUN echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \ | |
chmod 0440 /etc/sudoers.d/user | |
# install vs code and extensions | |
RUN apt-get install -y software-properties-common apt-transport-https wget | |
RUN wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add - | |
RUN add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | |
RUN apt-get install -y code libasound2 | |
USER user | |
RUN code --install-extension PeterJausovec.vscode-docker --force | |
USER root | |
EXPOSE 22 | |
CMD ["/usr/sbin/sshd", "-D"] | |
# build with | |
# docker build -t code-devbox . | |
# and run with | |
# docker run -d -p 2222:22 -v ~/.ssh/id_rsa.pub:/home/user/.ssh/authorized_keys code-devbox | |
# and connect with | |
# ssh -X user@localhost -p 2222 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment