@nomiclabs/hardhat-docker
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

npm hardhat

hardhat-docker

What

A library to manage Docker from Hardhat plugins.

Installation

npm install @nomiclabs/hardhat-docker

Usage

Importing HardhatDocker

const { HardhatDocker } = require("@nomiclabs/hardhat-docker");

Running Docker container

const image = { repository: "alpine", tag: "latest" };
const docker = await HardhatDocker.create();

if (!(await docker.hasPulledImage(image))) {
  await docker.pullImage(image);
}

const { statusCode, stdout, stderr } = await docker.runContainer(image, [
  "echo",
  "Hello world!",
]);

console.log(stdout.toString());

Available methods

Method Description Arguments Return Type
isInstalled check if docker is installed Promise<boolean>
imageExists check if docker image is available on docker hub Image Promise<boolean>
hasPulledImage check if docker image is pulled Image Promise<boolean>
isImageUpToDate check if latest docker image is installed Image Promise<boolean>
pullImage pulls docker image from docker hub Image Promise<void>
imageToRepoTag returns image repository tag Image String
runContainer runs docker container Image, command Promise<ProcessResult>

Readme

Keywords

Package Sidebar

Install

npm i @nomiclabs/hardhat-docker

Weekly Downloads

10,269

Version

2.0.2

License

MIT

Unpacked Size

43.6 kB

Total Files

28

Last publish

Collaborators

  • schaable
  • kanej
  • fzeoli
  • alcuadrado
  • fvictorio