linuxdockernetwork-programmingbuildauthority

Docker images are only in the sudo account and not connected to internet


I am currently using ubuntu 22.04.

I'm trying to build a docker image.

However, I got some problems when running the following command:

$ docker build -t myname ./

The error message I received is:

Temporary failure resolving 'archive.ubuntu.com'

I came across a solution on Stack Overflow at this URL :

Docker build "Could not resolve 'archive.ubuntu.com'" apt-get fails to install anything

Which suggests that it might be a DNS problem.

I accepted to create '/etc/docker/daemon.json' file as recommended in the URL but couldn't resolve the issue.

So I also tried using the '--network host' method.

$ docker build --network host -t myname ./

But the result was the same.

Finally, I attempted:

$ sudo docker build --network host -t myname ./

This seemed to work, but after completing the build, I couldn‘t see the images with the following command.

$ docker images
REPOSITORY   TAG       IMAGE ID       CREATED      SIZE

However, I could see the images with 'sudo':

$ sudo docker images
REPOSITORY    TAG       IMAGE ID       CREATED          SIZE
myname        latest    0f94e12e6ddd   39 minutes ago   10.8GB
hello-world   latest    d2c94e258dcb   8 months ago     13.3kB

Even though I granted superuser authority to my user, the issue persists.

The main problem is that without 'sudo', I can't resolve the DNS problem, but with 'sudo', I cant' use Docker images without 'sudo'.


Solution

  • You installed docker engine and Docker Desktop for Linux at the same time; one is enough.

    My recommendation is to remove Docker Desktop and stick to docker engine.