vue.js – Open VS Code from inside a docker container

vue.js – Open VS Code from inside a docker container

Yes, if you dont mind running your vue tools inside the docker container as well. You have to set up a .devcontainer.json file specifying the dockerfile or image or dockercompose file to use to build the container. It will create the container for you and automatically mount your project directory by default, but there are a lot of alternative configuration options as well.

This means youd open VS Code and basically your whole IDE would be in the docker container. You could call vue tools from the VS Code terminal, including calls to code.

Ive been doing this with some tensorflow stuff for the last 6 weeks or so. It was a little confusing at first, but now I really like it.

One challenge Ive encountered so far is that if you are deploying your image as a deliverable, using a container as a dev environment can cause some dev tool creep into the image (like including dev tools in your Dockerfile that you need in development but dont want in the deployed image). There are probably good ways to deal with this but I havent explored them all yet.

Another note: I cant seem to find the docs, but I think the recommended way is to use WSL2-backed docker, and then do all your docker mounting and docker client invocations from the WSL2 filesystem to docker instead of from Windows to Docker. I guess if WSL2 and docker are sharing the same VM, the mounted file systems are faster between WSL2/Docker than from Windows/Docker. This has worked well for me so far…

Ive managed to adapt this dockerized version of VS Code to our restrictive runtime environment (Openshift), although it does assume connection to the internet, so extensions and Intellisense ML model had to be preinstalled:

https://hub.docker.com/r/codercom/code-server

vue.js – Open VS Code from inside a docker container

Leave a Reply

Your email address will not be published.