I am trying to build an image using Dockerfile present in a given directory (using dockerode in Node.js).
const Dockerode = require("dockerode");
const dockerode = new Dockerode();
const image_path = "./images/cpp/Dockerfile";
const image_tag = "rce-spawner";
await dockerode.buildImage(
{ dockerfile: image_path },
{ t: image_tag }
);
But I keep getting data.on is not a function
.
According to the documentation of .buildImage()
(https://docs.docker.com/engine/api/v1.37/#tag/Image/operation/ImageBuild), it says that the 'dockerfile' parameter has to be passed the build context, which is exactly what I am doing. Why do I keep getting this error then?