I’ve configured Homeassistant and VCode (code-server) in a docker-compose.yaml
.
The goal is to edit Homeassistant config files in with Visual Code:
configuration.yaml:
version: "3"
services:
homeassistant:
image: homeassistant/raspberrypi4-homeassistant:stable
container_name: homeassistant
restart: always
networks:
- web
ports:
- 8123:8123
environment:
- TZ=Europe/Amsterdam
volumes:
# Homeassistant config directory
- ./volumes/homeassistant/config:/config
# Timezone configuration (Linux only)
- /etc/localtime:/etc/localtime:ro
vcode:
image: ghcr.io/linuxserver/code-server
container_name: vcode
restart: always
networks:
- web
ports:
- 8443:8443
environment:
- PUID=1000
- PGID=1000
- UMASK=022
- TZ=Europe/Amsterdam
- PASSWORD=password #optional
- SUDO_PASSWORD=password #optional
#- SUDO_PASSWORD_HASH= #optional
- PROXY_DOMAIN=raspberry #optional
volumes:
# VCode volume:
- ./volumes/vcode/config:/config
# Homeassistant config directory:
- ./volumes/homeassistant/config:/homeassistant
networks:
web:
driver: bridge
The vcode container runs with user 1000:1000, but cannot write to the Homeassistant volume directory ./volumes/homeassistant/config
which is always root:root
, no matter if PUID/GUID
or user: 1000:1000
configured.
What would be a good solution to configure the containers?