Visual Studio Code in Docker

Microsoft released its Visual Studio Code also for Linux. But I’m not really sure i want to keep a binary from them and Docker is really nice to build isolated software environments.

Visual Studio in Docker

Visual Studio Code is a very nice IDE with javascript autocompletion. Similar to Atom editor.

# Dockerfile  
FROM debian:8

ENV DEBIAN_FRONTEND noninteractive  
RUN apt-get update && apt-get install -y unzip sudo libgtk2.0-0 libgconf2-4 libnss3 \  
            libasound2 libxtst6 libcanberra-gtk-module libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*

# source http://download.microsoft.com/download/0/D/5/0D57186C-834B-463A-AECB-BC55A8E466AE/VSCode-linux-x64.zip  
ADD ./VSCode-linux-x64.zip /vcs/

WORKDIR /vcs  
RUN unzip VSCode-linux-x64.zip && rm VSCode-linux-x64.zip  
RUN adduser --disabled-login --uid 1000 \--gecos 'dummy' dummy

CMD ["sudo","-u","dummy","/vcs/Code"]  

So here is the code to build your VCS image. You need to download VSCode-linux-x64.zip from https://code.visualstudio.com and put it in the same directory of the Dockerfile.

Then run:

docker build -t grigio/vcs .

It will take a while, because many dependencies are needed, but you’ll run it once.

Now everytime you want to use it just run:

docker run -ti -e DISPLAY -v $HOME/.Xauthority:/home/dummy/.Xauthority -v $PWD:/shared --net=host grigio/vcs

And it will run instantly. It won’t see the rest of your system but on the current directory $PWD or the directory you’d decide to mount.

If you are interested some other Docker Apps are on Github.
Inspired by Running GUI apps with Docker post.

corso javascript