Permission denied when trying to start coder container

Hello! I have copied the example compose file and changesdvolumes to bind mounts. However, when I start container I get permission error: error: create cache directory: mkdir /home/coder/.cache: permission denied Here's the compose:
version: "3.9"
services:
coder:
# This MUST be stable for our documentation and
# other automations.
image: ghcr.io/coder/coder:${CODER_VERSION:-latest}
ports:
- "7080:7080"
environment:
CODER_PG_CONNECTION_URL: "postgresql://${POSTGRES_USER:-username}:${POSTGRES_PASSWORD:-password}@database/${POSTGRES_DB:-coder}?sslmode=disable"
CODER_HTTP_ADDRESS: "0.0.0.0:7080"
CODER_ACCESS_URL: "https://coder.playxe.org"

group_add:
- "281" # docker group on host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/user/Coder/home:/home/coder
depends_on:
database:
condition: service_healthy
database:
# Minimum supported version is 13.
# More versions here: https://hub.docker.com/_/postgres
image: "postgres:16"
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-username} # The PostgreSQL user (useful to connect to the database)
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} # The PostgreSQL password (useful to connect to the database)
POSTGRES_DB: ${POSTGRES_DB:-coder} # The PostgreSQL default database (automatically created at first launch)
volumes:
- /mnt/user/Coder/data:/var/lib/postgresql/data # Use "docker volume rm coder_coder_data" to reset Coder
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-username} -d ${POSTGRES_DB:-coder}",
]
interval: 5s
timeout: 5s
retries: 5
version: "3.9"
services:
coder:
# This MUST be stable for our documentation and
# other automations.
image: ghcr.io/coder/coder:${CODER_VERSION:-latest}
ports:
- "7080:7080"
environment:
CODER_PG_CONNECTION_URL: "postgresql://${POSTGRES_USER:-username}:${POSTGRES_PASSWORD:-password}@database/${POSTGRES_DB:-coder}?sslmode=disable"
CODER_HTTP_ADDRESS: "0.0.0.0:7080"
CODER_ACCESS_URL: "https://coder.playxe.org"

group_add:
- "281" # docker group on host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/user/Coder/home:/home/coder
depends_on:
database:
condition: service_healthy
database:
# Minimum supported version is 13.
# More versions here: https://hub.docker.com/_/postgres
image: "postgres:16"
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-username} # The PostgreSQL user (useful to connect to the database)
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} # The PostgreSQL password (useful to connect to the database)
POSTGRES_DB: ${POSTGRES_DB:-coder} # The PostgreSQL default database (automatically created at first launch)
volumes:
- /mnt/user/Coder/data:/var/lib/postgresql/data # Use "docker volume rm coder_coder_data" to reset Coder
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-username} -d ${POSTGRES_DB:-coder}",
]
interval: 5s
timeout: 5s
retries: 5
22 Replies
Codercord
Codercord3w ago
Codercord
Codercord3w ago
<#1376386277795958875>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys2w ago
could you share your full terraform template please?
playX
playXOP2w ago
It's default docker template with no changes
Phorcys
Phorcys2w ago
let me take a look then is it the regular docker template or the devcontainers one?
playX
playXOP2w ago
regular docker I've solved the problem by moving docker data-root to the storage in unRAID but that obviously is not perfect
Phorcys
Phorcys2w ago
are you able to open a terminal and run stat /home/coder in a scenario where this is broken?
playX
playXOP2w ago
as in, open shell inside coder container or inside workspace?
Phorcys
Phorcys2w ago
inside the workspace
playX
playXOP2w ago
no, I can't even create workspace it does not start coder container because of this permission error
Phorcys
Phorcys2w ago
are you sure it's not just in a failed state? you should still be able to open a terminal
playX
playXOP2w ago
hm let me recrete the container to check
Phorcys
Phorcys2w ago
you can also send a screenshot if you want
playX
playXOP2w ago
yea it does not even start
No description
Phorcys
Phorcys2w ago
can you send a screenshot of the full page?
playX
playXOP2w ago
No description
playX
playXOP2w ago
No description
Phorcys
Phorcys2w ago
oh sorry, I thought you meant that the workspaces themselves had this error! this is something that happened recently so I thought it could be related the solution would be to remove the mount you set up on /home/coder this line: - /mnt/user/Coder/home:/home/coder is there any particular reason you set that up? you do not need to persist it at all as all the data/state is stored in the postgres database
playX
playXOP2w ago
hm? Isn't the home directory active when I open workspace? like, it would store all my persistent data etc
Phorcys
Phorcys2w ago
no! the way Coder works is it creates new containers and volumes for each workspace
playX
playXOP2w ago
oh I see now thanks why the need for /home/coder then? anyway, I still wanted to have these volumes created on my SSD ZFS array rather than USB thumbstick unraid runs on or HDD array
Phorcys
Phorcys11h ago
hey, sorry for the delay, it is not needed for the Coder server itself, it is needed for the Coder workspaces /home/coder is persisted by your Docker template and it creates a volume, the Coder server container actually is only responsible for deploying the containers that your workspaces use

Did you find this page helpful?