Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

327
Vistas
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.

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

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

about 4 years ago · Santiago Trujillo Denunciar

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

about 4 years ago · Santiago Trujillo Denunciar

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

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda