Docker container for VS Code.
943
A Docker container for VS Code.
These instructions will cover usage information and for the Docker container.
In order to run this container you'll need Docker installed.
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 .
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 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
DISPLAY - the X display server that the GUI applications will connect to/home/dev/.vscode - workspace configuration files/home/dev/.config/Code - user configuration filesThis project is licensed under the MIT License - see the LICENSE file for details.
Content type
Image
Digest
Size
219.6 MB
Last updated
about 7 years ago
docker pull marcelohmariano/vscode