@lifeomic/test-tool-docker
TypeScript icon, indicating that this package has built-in type declarations

5.2.0 • Public • Published

@lifeomic/test-tool-docker

npm Build Status

Convenience methods for interacting with Docker

executeContainerCommand pullImage imageExists ensureImage getHostAddress

Container

executeContainerCommand

Executes the container with several convenience options.

ExecuteCommandConfig Description
container A dockerode container
command The command to be sent to the container
environment environment variables to be sent to the container. Should be in the format ENV_NAME=ENV_VALUE
stdin? If set then the string is sent as an end command to the container stream

Image

pullImage

Pulls the image into the current Docker environment

arg Description
docker A dockerode instance
image The image to be pulled. <image-name>[:<tag>]

imageExists

Returns if the image exists in the local docker environment.

arg Description
docker A dockerode instance
image The image to be checked. <image-name>[:<tag>]

ensureImage

Will pull the image from the remote repository if it isn't already present locally.

arg Description
docker A dockerode instance
image The image to be checked. <image-name>[:<tag>]

Utility methods

getHostAddress

Will return the Docker host address.

If process.env.DOCKER_HOST_ADDR is set, then that value will be returned.

When running on MacOS and require('os').type() === 'Darwin' then '127.0.0.1' will be returned.

Otherwise, we will start up an alpine image and return the default inet address.

dockerode

Readme

Keywords

none

Package Sidebar

Install

npm i @lifeomic/test-tool-docker

Weekly Downloads

253

Version

5.2.0

License

MIT

Unpacked Size

30.4 kB

Total Files

12

Last publish

Collaborators

  • lifeomicdev
  • npm-lifeomicdev-github