Permission denied when running as a docker container #15960
|
I cloned and run docker-compose, but i dont know how Coder can connect to Docker. While i Create Template from Docker, it's show:
docker-compose.yaml
.env
|
Replies: 9 comments
|
For docker you can use |
|
We should add an FAQ or a troubleshooting section to Docker installation docs, as this is a common issue. |
|
I have the same problem. I added my docker group id in the docker compose file under |
|
If you are running "Docker on Windows" this worked for me (Windows 10): ...
services:
coder:
image: ghcr.io/coder/coder:${CODER_VERSION:-latest}
user: ${PUID}:${PGID} # <--- NEEDED
environment:
...
PUID: ${PUID} # <--- NEEDED
PGID: ${PGID} # <--- NEEDED
volumes:
- /var/run/docker.sock:/var/run/docker.sock
... |
|
Hi! Can you reach out on discord if you are still running into this? https://discord.gg/coder |
This solution also worked on Ubuntu 24.04, if anyone else is having this issue. Thank you! |
|
It cannot work for me on Ubuntu 24.01, create coder user and add to docker group And create docker stack yml version: "3.9"
services:
coder:
image: ghcr.io/coder/coder:${CODER_VERSION:-v2.17.3}
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://example.com"
PUID: 1003
PGID: 1003
user: 1003:1003
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/nas_disk/docker_volumes/code_server/coder:/home/coder
database:
image: "postgres:16"
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/nas_disk/docker_volumes/code_server/pg:/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: 5But create docker template go error |
|
Hi @seepine , You need to add services:
coder:
image: ghcr.io/coder/coder:${CODER_VERSION:-v2.17.3}
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://example.com"
group_add:
- "998"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
... |
|
Thanks, it can work #...
group_add:
- "994" # exec `cat /etc/group | grep docker` and got docker gid
#... |
Thanks, it can work