In the previous recipe, we explored a few actions on Docker images using APIs. In this recipe, we will build a Docker image using the /build API. Here is the /build API snippet from Swagger Editor:
Building images using APIs
How to do it...
- Begin by cloning the https://github.com/docker-cookbook/apache2 repository, as follows:
$ git clone https://github.com/docker-cookbook/apache2
This repository contains the Dockerfile to bundle an apache2 service; listed here is the content of the Dockerfile:
- Let's create the build context by bundling the content of the cloned apache2 repository as a tar file, as demonstrated here:
$ cd apache2 $ tar cvf /tmp/apache2.tar *
- Continue on to build the Docker...