Better way to install Docker:
Recently I found that there is a better way to install docker
using just one command:
wget -qO- https://get.docker.com/ | sh
My Problem Solution: I have read many articles to solve the problem and I have learned so many things and the detailed solution is in this link.
The answer is that whenever I wanted to use apt-get it was locked. So I should kill the other processes that didn't let me to access the file. So by entering the following command you can see the processes and their numbers:
ps ax | grep -i apt
After seeing the processes ids, it's time for killing the processes by the following command:
sudo kill -9 <process id>
Eventually, I have run docker run hello-world
without any errors.
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
sudo docker run hello-world
? – Freddy May 8 '19 at 0:45Unable to find image 'hello-world:latest' locally
– Mostafa Ghadimi May 8 '19 at 0:49docker login
first? I found this here. – Freddy May 8 '19 at 1:05