Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install VS Code extensions in a Dockerfile?

Is there a way to install VS Code extensions in a Dockerfile?

like image 575
curtank Avatar asked Dec 09 '25 05:12

curtank


1 Answers

If your goal is not to repeat the installation of the VS code extensions, my suggestion is to mount $HOME/.vscode-server/.

For example, in a docker-compose.yml

services:
    your_container:
        ...
        volumes:
            - ./volume/vscode-server:$HOME/.vscode-server

Or in docker run

docker run -it -v ./volume/vscode-server:$HOME/.vscode-server your_image bash

Then, install the required extensions inside the container. The next time you set up the container, there will be no need to reinstall extensions.

like image 130
Marc-Antoine Avatar answered Dec 10 '25 17:12

Marc-Antoine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!