Why docker-compose.yml: Permission denied Happened🔗
Shell redirection (> / <<EOF) occurs before sudo, so the target file is opened by your unprivileged shell.
Correct Patterns🔗
Use sudo tee:
sudo tee docker-compose.yml >/dev/null <<'YAML'
services:
app:
image: example
YAML
Or create the file as root-owned directory you control, then adjust ownership:
sudo install -d -o $USER -g $USER /srv/apps/nocodb