I'm using Docker on Mac and trying to open a project with Docker or Ddev. I have 2 users: admin and my user for work, who has no sudo rights. When I need to do something, that requires writing permissions, I just switch in the terminal to my admin user and execute all the commands from there. So, I'm logged into my working user and I'm trying to open a project(fin init for or ddev start) and I get that "ERROR: Docker Desktop is not running" text. What can I do with it?
I think you'll find that Docker Desktop isn't really a multi-user app, and is never intended for that. You'll also find that DDEV isn't a multi-user app due to port conflicts.
The actual answer is: Install Docker Desktop for the user you want to use it.
A quick google shows this approach, which may work, of course it starts out with "First, be aware that docker is not designed to be securely shared among multiple users"
You may also want to try Colima, which is probably more generous about this, and is stored in separate users. But I would not be surprised if you can't run it with both users at the same time. See DDEV docs for colima.
UPDATE:
After trying several approaches, it's impossible to run docker in two users simultaneously, but you can enable it on each user. I've added this to my .bashrc/.zshrc
on each user.
alias enable-docker="sudo rm /var/run/docker.sock && sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock"
If I'm logged with User1 I just open the terminal and run enable-docker
. When I finish using Docker with User1 I close it and switch to User2 session and run enable-docker
.
OLD PROPOSAL: This will work one time.
Add export DOCKER_HOST=unix://$HOME/.docker/run/docker.sock
to your .bashrc/.zshrc
on your Mac and then source it or open a new terminal.
Credits
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With