Got permission denied while trying to connect to the Docker daemon

When trying to create an docker container template i always get this error:
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
on main.tf line 19, in provider "docker":
19: provider "docker" {
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
on main.tf line 19, in provider "docker":
19: provider "docker" {
7 Replies
Codercord
Codercord5mo ago
<#1265418380383486123>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
WolfsCoding
WolfsCodingOP5mo ago
- Installed coder/coder v1.0.1 (signed by a HashiCorp partner, key ID 93C75807601AA0EC)
- Installing kreuzwerker/docker v3.0.2...
- Installed kreuzwerker/docker v3.0.2 (self-signed, key ID BD080C4571C6104C)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Terraform 1.8.4
data.coder_provisioner.me: Refreshing...
data.coder_provisioner.me: Refresh complete after 0s [id=b61f52da-33c4-4f11-b519-a1d5f20bee58]
data.coder_workspace_owner.me: Refreshing...
data.coder_workspace.me: Refreshing...
data.coder_workspace.me: Refresh complete after 0s [id=b92d1d5b-7e49-4084-9999-e8aa1c6538f3]
data.coder_workspace_owner.me: Refresh complete after 0s [id=aa3f335d-e35d-4bcf-8053-346d4e74d07c]
coder_agent.main: Plan to create
coder_app.code-server: Plan to create
Plan: 2 to add, 0 to change, 0 to destroy.
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
on main.tf line 19, in provider "docker":
19: provider "docker" {
- Installed coder/coder v1.0.1 (signed by a HashiCorp partner, key ID 93C75807601AA0EC)
- Installing kreuzwerker/docker v3.0.2...
- Installed kreuzwerker/docker v3.0.2 (self-signed, key ID BD080C4571C6104C)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Terraform 1.8.4
data.coder_provisioner.me: Refreshing...
data.coder_provisioner.me: Refresh complete after 0s [id=b61f52da-33c4-4f11-b519-a1d5f20bee58]
data.coder_workspace_owner.me: Refreshing...
data.coder_workspace.me: Refreshing...
data.coder_workspace.me: Refresh complete after 0s [id=b92d1d5b-7e49-4084-9999-e8aa1c6538f3]
data.coder_workspace_owner.me: Refresh complete after 0s [id=aa3f335d-e35d-4bcf-8053-346d4e74d07c]
coder_agent.main: Plan to create
coder_app.code-server: Plan to create
Plan: 2 to add, 0 to change, 0 to destroy.
Error: Error pinging Docker server: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
on main.tf line 19, in provider "docker":
19: provider "docker" {
Nano
Nano5mo ago
Have you tried setting up docker rootless? https://docs.docker.com/engine/security/rootless/
Docker Documentation
Run the Docker daemon as a non-root user (Rootless mode)
Run the Docker daemon as a non-root user (Rootless mode)
Nano
Nano5mo ago
@WolfsCoding
Atif
Atif4mo ago
Depending on how you installed Coder you need to add user Coder to the docker group.
Phorcys
Phorcys4mo ago
User has left the server, closing.
Codercord
Codercord4mo ago
@Phorcys closed the thread.
Want results from more Discord servers?
Add your server