0

I don't know who kill my docker daemon. After that, my docker stopped and I try to use some commands like
service docker start,
systemctl restart docker,
systemctl daemon-reload is not useful.

So I uninstall docker and remove all docker env files. Then I reinstall docker, but when I use docker ps, the screen prints the error Cannot connect to the Docker daemon at tcp://0.0.0.0:1000. Is the docker daemon running?

If use sudo docker ps, it works. So I try to add my account to sudo group then use docker ps, but get the same error.

My previous config file set the tcp for pycharm. But my new config file is the default.

Although I can add sudo to use docker, I still want to figure it out.

Thanks for your help!

ning
  • 11
  • 2

1 Answers1

0

This is a security feature. The socket is owned by root. If there is a usergroup docker it is owned by this. So add your user to this group:

 sudo groupadd docker
 sudo usermod -aG docker $USER

Logout and -in after that.

This group grants root-like rights, so be sure whom you trust..

Check also env | grep DOCKER_HOST, should be no value. If there is a value do unset DOCKER_HOST.

araisch
  • 1,727
  • 4
  • 15
  • Thanks for your help! I successfully solve the problem! – ning May 19 '22 at 07:35
  • You're welcome. If an answer is helpful feel free to vote it up by clicking the arrow up and if it fully answers your question mark it as solution with the green tick. This helps others to see that it is solved and what to read first if they search for answers. This also makes a "Thank you" comment unnecessary and benefiting the user helped you with points. – araisch May 19 '22 at 09:02
  • If this turns out to be the actual issue, consider flagging it as a duplicate of [How to fix docker: Got permission denied issue](https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue) rather than repeating its answers. – David Maze May 19 '22 at 10:11
  • That's true but to welcome new members it is a quite harsh way. On next question I'd do that.. step by step :) – araisch May 19 '22 at 13:01