Even though I am in Docker group on Ubuntu, I still cant issue commands without sudo

OS Ubuntu 22.04
VSCode

Docker daemon is running.

even though I am in docker group, I still cant use commands without “sudo”.

Please, share error messages as formatted texts instead of pictures, as we can refer to texts more easily.

Based on the picture it looks like you are in the rootless context and the rootless docker is not running. If you check the error messages you can see that the socket mentioned in the systemd log is not the same as in the error message.

List the docker contexts

docker context ls

and switch to the correct context which is probably “default”

docker context use default

Also make sure you install only one Docker. Ubuntu supports multiple variants of Docker. Do not use “snap” and if you install Docker Desktop, you probably don’t want to use Docker CE. If you want to use Docker CE, don’t install Docker Desktop unless you are sure you need both and you know how they work together.

1 Like

I have recently started to learn Containers and Docker.

  1. I’ll take care of the formatted text suggestion.
  2. I installed Docker as it was instructed on Ubuntu website. I don’t know whether it was done using snap.
    I am following a tutorial on YouTube which requires both Docker Desktop and Docker command-line version (which most probably you are referring to as Docker CE). Most of the work is done on command-line but to make things clear, Desktop version is also used.

If you can clear these confusions, I’ll be highly obliged. Or you can point me to some document also. That is also fine.

Please, share the link. The Docker documentation shows multiple ways. (none of them are based on snap)

Now that is an imprtant detail. So you actually installed Docker Desktop which is probably not running.

No. Docker CE has multiple components. It is the Docker Community Edition which is installed inside the virtual machine of Docker Desktop too. In case of Docker Desktop you need only the client component of Docker CE. In other words the the Docker CLI. On ubuntu it is called docker-ce-cli.

If you need more clarification, please, share the Youtube tutorial too. Otherwise I can’t tell you if you need Docker Desktop or not. but it is higly unlikely that you need Docker CE (except the client) when you need Docker Desktop. The official documentation of the installation process of Docker Desktop mentions only to add the APT repository of Docker, but if you install Docker Desktop, it will use that repository to install the client without the daemon.

Sorry, my mistake. This is the link I used for installation https://docs.docker.com/engine/install/ubuntu/
Clarification please, my main problem was I couldn’t run docker without sudo even though I am in docker group which you already gave solution to.
And now that you’ve mentioned, I wont pay attention to parts of tutorial where they verify the actions on Docker Desktop. Let me learn Docker properly and then I’ll come back to that again. Here is the link of the tutorial https://www.youtube.com/watch?v=kTp5xUtcalw&list=PLubdeCMkkh9xQ8n_-NpfzfGJj4P4JiLLT&index=79