Docker Community Forums

Share and learn in the Docker community.

How to run Docker commands during Dockerfile build


#1

Hi, I want to run docker commands inside Dockerfile to build image. My project uses docker on build jar phase.
My problem is that I fail to run docker build . on folowing Dockerfile:

FROM docker
RUN docker ps

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

I know that docker build has many limitations, but I want to bypass it somehow…

Thanks a lot!


#2

what is the use-case?