How do I build docker images without docker?

Is there some lightweight way I can build a docker image within a container without having a working docker machine. Here’s what I’m trying to do:

$ docker run -it --rm docker:latest

/ # mkdir test
/ # touch test/Dockerfile
/ # docker build test
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Assuming I had a valid Dockerfile in place, is there some way I could create an docker image from within a container like this?

  • How to publish a port different from the default one?
  • How to configure docker default bridge work with unusual network configuration?
  • What is the differenece between Docker Registry and Docker Index?
  • Run bash command before running container
  • Can't interact with java process when attaching
  • configure Dokku (Procfile) to use specific Docker image
  • Deploy to docker with nginx, django, daphne
  • docker swarm compose constraints
  • How can I docker-build with Dockerfile?
  • Docker on windows 10 can't startup after deleting MobyLinuxVM in Hyper-V manually
  • How to link two docker containers which are spawned with two different docker-compose.yml
  • how to add --auth for mongodb image when using docker-compose?
  • One Solution collect form web for “How do I build docker images without docker?”

    Part of the problem could be that you’re missing the --privileged flag, but in general, your questions can probably be answered here:

    And you might take the time to read the blog linked there detailing some of the pitfalls of using docker-in-docker.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.