I follow the documentation page of docker to install it on my ubuntu step by step.

After I've installed the docker-ce successfully, I have get the following message in terminal:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
docker-ce is already the newest version (5:18.09.6~3-0~ubuntu-bionic).
0 upgraded, 0 newly installed, 0 to remove and 473 not upgraded.

Problem: Whenever I run the following command in terminal, I face with no such file or directory error!

Here is what I have executed in terminal:

sudo apt-get install docker-ce=<5:18.09.6~3-0~ubuntu-bionic> docker-ce-cli=<5:18.09.6~3-0~ubuntu-bionic> containerd.io
  • 1
    It looks as if docker-ce is already installed. What happens if you run sudo docker run hello-world? – Freddy May 8 '19 at 0:45
  • @Freddy Unable to find image 'hello-world:latest' locally – Mostafa Ghadimi May 8 '19 at 0:49
  • 1
    Strange. According to the documentation this should download and run a test image... – Freddy May 8 '19 at 0:57
  • 1
    And if you run docker login first? I found this here. – Freddy May 8 '19 at 1:05
  • @Freddy yeah, now I am logged in but still the same error :( – Mostafa Ghadimi May 8 '19 at 1:30

In bash (which you are most likely using), tildes (~) are treated specially. ~ by itself expands to your home directory, while ~user expands to user's home directory.

To fix this, quote the docker-ce and docker-ce-cli arguments:

sudo apt-get install "docker-ce=<5:18.09.6~3-0~ubuntu-bionic>" "docker-ce-cli:<5:18.09.6~3-0~ubuntu-bionic>" containerd.io
  • I have added the answer :). – Mostafa Ghadimi May 8 '19 at 13:09
  • 1
    In the middle of a filename/string the ~ is no longer special. What is special are the < and > characters. Quoting the package names stopped these redirecting stdin and stdout, removing the cause of the No such file or directory error. – roaima May 10 '19 at 18:53

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.
 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:

For more examples and ideas, visit:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.