1

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

  1. Use sudo. Didn't work.
  2. sudo usermod -aG docker <your username>. Didn't work.
  3. 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:

  1. https://docs.docker.com/engine/installation/linux/ubuntulinux/
  2. 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/

  • What it is the release of the Ubuntu container? – Bidyut Nov 24 '16 at 19:43
  • @Bidyut: It is ubuntu:16.04. You can check the container here store.docker.com/images/… – Tarik Nov 24 '16 at 21:12
  • If you are runnning a ubuntu:16.04 inside the container, then inside you will be logged in as root. So you need not have to install sudo – Bidyut Nov 25 '16 at 4:50
  • @Bidyut: Thanks for your time, but it is not helpful. I already mentioned that in my post. – Tarik Nov 25 '16 at 23:26
0

Inside you Ubuntu:xenial container perform the following. [assuming you will be using the root user inside the container]

apt-get update

apt-get install apt-transport-https ca-certificates

apt-key adv \ --keyserver hkp://ha.pool.sks-keyservers.net:80 \ --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

echo "<REPO>" | sudo tee /etc/apt/sources.list.d/docker.list

In place of repo add the deb https://apt.dockerproject.org/repo ubuntu-xenial main

apt-get update

apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

apt-get install docker-engine

The above steps should install docker inside your container.

Please refer to this link

  • Thanks, but these don't help. Perhaps, the containers miss something that is crucial to Docker. – Tarik Nov 26 '16 at 5:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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