Sign inSign up

marcelohmariano/vscode

By marcelohmariano

•Updated about 7 years ago

Docker container for VS Code.

Image
0

945

marcelohmariano/vscode repository overview

⁠VS Code Container

GitHub Docker Cloud Automated build Docker Cloud Build Status

A Docker container for VS Code⁠.

⁠Getting Started

These instructions will cover usage information and for the Docker container.

⁠Prerequisities

In order to run this container you'll need Docker⁠ installed.

⁠Installation

Pull the image from the Docker repository:

docker pull marcelohmariano/vscode
docker tag marcelohmariano/vscode code
docker rmi marcelohmariano/vscode

Or build the image from source:

git clone https://github.com/marcelohmariano/vscode-container.git
cd vscode-container
docker build -t code .
⁠Usage
⁠Run

Start VS Code (this is the default when no command is specified):

docker run -it --rm --privileged \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix/:/tmp/.X11-unix \
  -v $HOME/.Xauthority:/home/dev/.Xauthority \
  -v code:/home/dev/.vscode \
  -v code:/home/dev/.config/Code \
  --network host \
  code

Open a project folder:

cd project-folder
docker run -it --rm --privileged \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix/:/tmp/.X11-unix \
  -v $HOME/.Xauthority:/home/dev/.Xauthority \
  -v code:/home/dev/.vscode \
  -v code:/home/dev/.config/Code \
  -v $PWD:/home/dev/project-folder \
  -w /home/dev/project-folder \
  --network host \
  code .

Install extensions:

docker run -it --rm \
  -v code:/home/dev/.vscode \
  code --install-extension <extension-id>
⁠Create a Development Environment

Create a Dockerfile for the environment you want to create, e.g., C++ development environment:

FROM marcelohmariano/code

RUN \
  sudo zypper -n install -t pattern devel_C_C++ && \
  sudo zypper -n install \
    clang \
    cmake \
    gcc-c++ \
    ninja \
    python3-pip && \
  sudo pip3 install cpplint && \
  sudo zypper clean -a

Then, build the Docker image:

docker build -t code-cpp .

Finally, install the needed extensions to your VS Code:

docker run -it --rm \
  -v code:/home/dev/.vscode \
  code-cpp \
    --install-extension ms-vscode.cpptools \
    --install-extension twxs.cmake \
    --install-extension mine.cpplint
⁠Environment Variables
  • DISPLAY - the X display server that the GUI applications will connect to
⁠Volumes
  • /home/dev/.vscode - workspace configuration files
  • /home/dev/.config/Code - user configuration files

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

Size

219.6 MB

Last updated

about 7 years ago

docker pull marcelohmariano/vscode