I have successfully installed Docker to Ubuntu 16. But to issue commands properly, I am adding sudo
in front of all the docker commands such as sudo docker pull wordpress
. Anyway, the sudo
solved my Cannot connect to daemon
problem. However, I needed to install docker into an ubuntu container, in the same way, I did for the host computer. I have researched and found the following solutions, but they didn't work for the container (I ran apt-get update
before all these):
- Use
sudo
. Didn't work. sudo usermod -aG docker <your username>
. Didn't work.sudo usermod -aG docker $USER
. Didn't work.
About sudo
command, though, it was not available in the container. So I had to run apt-get install sudo
. Then, sudo
started working but not docker. docker
command itself works. But, when you make a request via Docker CLI to docker engine, it says it is not connected, or daemon is not working. Also, the default user in the docker ubuntu container is root
. When you enter into the bash TTY, you see root@[some number]
. I am using the following command to install docker: sudo apt-get install docker.io
. I have followed the instructions here to install docker on my host Linux machine:
- https://docs.docker.com/engine/installation/linux/ubuntulinux/
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
But what really worked was:
https://www.liquidweb.com/kb/how-to-install-docker-on-ubuntu-14-04-lts/
root
. So you need not have to installsudo