Run and Access GUI inside VS Code DevContainers
VS Code DevContainers allow us to easily configure and run a container with our development tech stack for the specific project or product we are working on — and have that fully integrated with our VS Code development environment. It does so leveraging Docker Desktop and WSL2. With just a few simple configuration steps, we can run the container from VS Code and work seamlessly with terminals that open in the container and exchange code changes back and from the container. This picture from the Code Visual Studio website visualizes the setup.
One thing we can easily do is add and subsequently expose the container’s GUI. In its simplest appearance, that gives us a basic desktop manager. It also allows us to run tools with a GUI inside the development container.
The steps to expose the GUI are simple:
In the features section in the devcontainer.json, add an entry for desktop-lite
,"desktop-lite": {"password": "vscode","webPort": "6080","vncPort": "5901"}