Running Visual Studio Code in Docker
This site is built using he static site generator Hugo. Posts were typically writeen using Vi over SSH. Remember this site is hosted with Caddy server via Cloudflare on a Raspberry Pi 4. Something better was needed, in come VS Code.
code: container_name: code image: ghcr.io/linuxserver/code-server environment: - PUID=1000 - PGID=1000 volumes: - /path/to/html:/config/workspace - ./code/extensions:/config/extensions - ./code/data:/config/data ports: - 8443:8443 restart: always
The docker-compose snippet above pulls the Linux Server image of Code server. It’s important to set the
PGUID so that the files are read and written by the right user. The volumes can then be defined to mount the directory used for Hugo into the vscode workspace. We then want to make sure all data and extensions are also maintained.