Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

337
Visualizações
Run docker build in ubuntu:16.04 docker

I want to build a docker image in docker container.

So, I tried to create a docker-installed ubuntu docker image following https://docs.docker.com/engine/installation/linux/ubuntu/, but failed.

FROM ubuntu:16.04

RUN apt-get update && \ 
    apt-get install -y \
        apt-transport-https \
        ca-certificates \
        software-properties-common

RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

RUN apt-key fingerprint 0EBFCD88

RUN add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

RUN apt-get update && \
    apt-get install -y docker-ce

When I run docker images or other commands on the docker image created by above Dockerfile, the error happens.

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Is there any way to solve this problem? Thanks.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Besides the affect of AWS environment, the problem you have is caused by that you did not start docker daemon inside your container, as the error message shown.

Here's the steps to show how to make it work manually:

  1. Start and enter a container using the image built from your Dockerfile:

    docker run --privileged -it dind /bin/bash

And here is the problem you have:

root@82d6eab69331:/# docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  1. Start docker daemon inside this container:

    root@82d6eab69331:~# /usr/bin/dockerd -H unix:///var/run/docker.sock > dockerd.log 2>&1 &

  2. Check log file to make sure it started correctly, and then try docker images:

    root@82d6eab69331:~# docker images REPOSITORY TAG IMAGE ID CREATED SIZE

So you may need to add entrypoint to start docker daemon in your Dockerfile. I test on environment of CentOS 7.2 and docker 1.12. Hope this could be helpful to you :-)

over 4 years ago · Santiago Trujillo Relatório

0

AWS CodeBuild doesn't "[..] allow customers to bring in their own Docker-in-Docker images [..]" yet.

We currently only support Docker-in-Docker (dind) with the official CodeBuild images

Source (Jan 12, 2017):

over 4 years ago · Santiago Trujillo Relatório

0

cannot connect to Docker daemon - you might need to run... Maybe, you can see the result this command.

$ sudo docker images

You should add your user in docker group. And then, you can use docker command without 'sudo'.

$ sudo usermod -aG docker ${USER}
$ sudo service docker restart

Next, you have to logout in your OS. Finally, when you login, you can use docker command without 'sudo'.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda