C
Coder.com2mo ago
Asher

Error while install Docker template

error log
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 22, in provider "docker":
22: 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 22, in provider "docker":
22: provider "docker" {
i install coder with docker comose https://github.com/coder/coder/blob/main/docker-compose.yaml
GitHub
coder/docker-compose.yaml at main · coder/coder
Provision remote development environments via Terraform - coder/coder
64 Replies
Codercord
Codercord2mo ago
<#1351458923466723380>
Category
Help needed
Product
Coder (v2)
Platform
macOS
Logs
Please post any relevant logs/error messages.
Asher
AsherOP2mo ago
hi can anyone help me please
Danielle
Danielle2mo ago
# If the coder user does not have write permissions on
# the docker socket, you can uncomment the following
# lines and set the group ID to one that has write
# permissions on the docker socket.
#group_add:
# - "998" # docker group on host
# If the coder user does not have write permissions on
# the docker socket, you can uncomment the following
# lines and set the group ID to one that has write
# permissions on the docker socket.
#group_add:
# - "998" # docker group on host
Did you follow the instructions at this part of the docker-compose file?
Asher
AsherOP2mo ago
oh sorry no let me do it now after i want ran getent group docker it didn't shows anything
Asher
AsherOP2mo ago
No description
Asher
AsherOP2mo ago
do i have to create one?
Atif
Atif2mo ago
try with sudo
Asher
AsherOP2mo ago
umm command not found
No description
Atif
Atif2mo ago
are you running this on the same system where docker compsoe is installed and you are running Coder?
Asher
AsherOP2mo ago
yes im running on same machine same system with docker compose
Asher
AsherOP2mo ago
No description
Asher
AsherOP2mo ago
and coder is running healthy
Danielle
Danielle2mo ago
I take it you're running on a Mac? If so, what tool are you using to run Docker containers
Phorcys
Phorcys2mo ago
(@Asher)
Asher
AsherOP2mo ago
yea im running on mac mini, use docker desktop to run the docker container after i changed 998 to 0 it worked but i have another question is how can in stall node.js in to developer env? do i install it on the template or i have do it in every workspaces? @Phorcys i have checked your docs but all was changed into private https://coder.com/blog/configuring-node-js-workspaces-in-coder
Phorcys
Phorcys2mo ago
that is pretty bad, please don't 0 is root this is for v1, which is outdated nice catch
Asher
AsherOP2mo ago
so what should i do? i can't found the group id for docker
Phorcys
Phorcys2mo ago
would you be able to run stat /var/run/docker.sock?
Asher
AsherOP2mo ago
team@teams-Mac-mini ~ % stat /var/run/docker.sock
16777232 21262568 lrwxr-xr-x 1 root daemon 0 35 "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" 4096 0 0 /var/run/docker.sock
team@teams-Mac-mini ~ % stat /var/run/docker.sock
16777232 21262568 lrwxr-xr-x 1 root daemon 0 35 "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" "Mar 21 09:47:57 2025" 4096 0 0 /var/run/docker.sock
Phorcys
Phorcys2mo ago
yeah i'm not sure you have a choice for this you should use the docker socket via tcp or ssh instead of using a file mount the issue with using the file-based approach on macOS is that you have to give the container access, and to do so the container user has to be part of the docker group, in your case it would be the daemon group, but AFAIK it's a generic group and isn't used only by Docker basically, using the file approach in this case creates a security hole or, run Coder on something that's either a. not macOS or b. not a container, if you run Coder standalone and give it access to Docker it should be fine
Asher
AsherOP2mo ago
because we only have mac so now we only have one option which is b is there are installation guide for us?
Phorcys
Phorcys2mo ago
you could use a Linux VM otherwise, but it's not that great
Asher
AsherOP2mo ago
the performance will not be great
Asher
AsherOP2mo ago
thanks
Phorcys
Phorcys2mo ago
make sure to install brew first i don't think we have a daemon for macOS though, so you might have to find a way to get coder server to run at startup
Asher
AsherOP2mo ago
let me first then i will let you know my progress thanks you for your help ok now i run coder server and it worked can i start the coder server in the background? and how can i install nvm in default? @Phorcys
Asher
AsherOP2mo ago
is these files must be here in default can i remove them?
No description
Asher
AsherOP2mo ago
and i have another question is right now im developing a angular web app and open the port on 4200
Asher
AsherOP2mo ago
and i go to the website and i see this how can i display my website on this page?
No description
Asher
AsherOP2mo ago
and im sure the my webapp is opened
No description
Asher
AsherOP2mo ago
hello, can anyone help me please hello? @Phorcys
Phorcys
Phorcys2mo ago
hey @Asher, sorry for the delay!
Asher
AsherOP2mo ago
🙏
Phorcys
Phorcys2mo ago
you can, by setting up a daemon
Phorcys
Phorcys2mo ago
it seems on macOS you can use launchd
Super User
Run command on startup / login (Mac OS X)
I was wondering which file I should place this bash command in so it will be run on startup. Start the MongoDB server /Applications/MongoDB/bin/mongod --dbpath /usr/local/mongo/data --fork --log...
Phorcys
Phorcys2mo ago
you can either edit the coder_agent's startup_script to install nvm or build your own Docker image with nvm preinstalled you shouldn't, these are your user's files, they store data for your profile this is a linux thing though, not specific to coder basically just treat them like system files what URL are you accessing? the one in the screenshot or something else? you should use the port forwarding feature for this, as you cannot access the machine's localhost directly, but you'll want to set up a wildcard domain for this
Asher
AsherOP2mo ago
when i clicked on the localhost:4200 it redirected me to this page
No description
Asher
AsherOP2mo ago
but i didn't show my webpage and i have tried using coder extension on vs code connected via ssh
Asher
AsherOP2mo ago
No description
Asher
AsherOP2mo ago
No description
Asher
AsherOP2mo ago
and it can't access the page and loaded 1 mins still has no response
Asher
AsherOP2mo ago
No description
Asher
AsherOP2mo ago
tried port fowarding but still an't access @Atif sorry for the ping do you know how the port foward works? am i did anything wrong?
Atif
Atif2mo ago
I have a few suggestions. Please check Coder docs for enabling wildcard access URL. It is needed for web port forwarding For docker I would suggest using orbstack or Colima and not the docker desktop That would also solve the isse where docker socker is owneyby root (0)
Asher
AsherOP2mo ago
right now im not using host coder on docker desktop. i installed coder via
curl -L https://coder.com/install.sh | sh
curl -L https://coder.com/install.sh | sh
Atif
Atif2mo ago
This is fine I am talking about installing docker to provision workspaces
Asher
AsherOP2mo ago
oo ok can i use cloudflare tunnel for enabling wildcard access url?
Atif
Atif2mo ago
You can try. I haven't done that myself. It's better to use a domain you own and set up coder behind a reverse proxy. We have docs for that. Caddy would be the easiest to follow
Asher
AsherOP2mo ago
ok thank you it will try to follow the docs
Asher
AsherOP2mo ago
No description
No description
No description
Asher
AsherOP2mo ago
@Atif it doesn't seems to be worked
Atif
Atif5w ago
its an http domian try removing thes Is the service running on this port is on http or https?
Asher
AsherOP4w ago
im using cloudflare tunnel to forward to request to port http://localhost:3000 and coder is running on port 3000 locally
Phorcys
Phorcys4w ago
you should set up your domain as follows : coder.hkdispenser.com for the instance *.coder.hkdispenser.com for the wildcard subdomain also, don't select https when forwarding the port
Asher
AsherOP4w ago
yes i did that
Phorcys
Phorcys3w ago
any luck?
Asher
AsherOP3w ago
sorry no
koad
koad3w ago
I had the same issue, the docker compose file says to use 998 as group ID . but this may not be the case, it depends on when docker was installed.. the getent program doesnt exist in mac, but in order to fix this issue @Asher you will need to discover which GID your docker group is .. and replace that 998 in the docker compose with your actual group ID
dscl . -read /Groups/docker | grep PrimaryGroupID
dscl . -read /Groups/docker | grep PrimaryGroupID
aparently this is the command you want to find your docker's GID ^
Phorcys
Phorcys3w ago
could you send a screen recording when doing port forwarding in the ui?
Asher
AsherOP2w ago
Asher
AsherOP2w ago
No description
Asher
AsherOP2w ago
No description
Phorcys
Phorcys2w ago
yeah the app does seem reply what does curl http://localhost:4200 output? is it configured to reply to that hostname?

Did you find this page helpful?