skip to Main Content

I build and run an Docker Container using sudo privilege to do so I ran bellow commands

This command to build the container and its build successfully.

sudo docker build -t getting-started .

After that I ran the docker container using bellow command

sudo docker run -dp 3000:3000 getting-started

After running the docker container everything is running fine and I am able to see my container when I ran bellow command

sudo docker ps

But the problem is I am not able to see my container that I just built and ran in my Docker Desktop.

Note: If I build and run the docker container without sudo privilege then I am able to see the container in Docker Desktop.

So now what should I do to manage my containers using Docker Desktop those are build and running using sudo privilege.

2

Answers


  1. i am facing the same problems for a while and didn’t get anything that worked for me as of yet but maybe in your case if you can enable docker to run in rootless mode or add your user to docker group enable privileges to enable the user to use docker with out sudo it may also work for the docker desktop to access those images in the sudo mode.
    try
    https://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo
    https://docs.docker.com/engine/install/linux-postinstall/

    the other solution i thought up is to make the docker desktop use the context you are using for the docker engine which is the default not the desktop-linux it will create when its starting up maybe that will enable it to read the past containers you were using

    or another solution is to run the docker desktop in sudo mode i dont know how to do that as of yet but its worth a shot if you can find out how

    Login or Signup to reply.
  2. if your build successed you can run

    docker ps -a 
    

    to see all the working and stoped containers

    and you can run

    docker logs --tail=50 container-name
    

    so you can see the container logs and start fixing the issue

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search