Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permanently install VS Code's server in container

Every time I start up a container to develop in it with VS Code's Remote - Containers extension the container has to re-download the vs-code-server. Is there any way to easily install the server within a Dockerfile so it doesn't have to reinstall every time?

like image 302
Ben Stickley Avatar asked Oct 24 '25 02:10

Ben Stickley


1 Answers

If using docker-compose, you can create a volume for the .vscode-server folder, so that it is persisted across runs.

Something like (in .devcontainer/docker-compose.yml):

version: "3"

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    command:
      - /bin/sh
      - -c
      - "while sleep 1000; do :; done"
    volumes:
      - ..:/workspace
      - vscode-server:/home/code/.vscode-server

volumes:
  vscode-server:
like image 57
pjoe Avatar answered Oct 25 '25 21:10

pjoe



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!