Socket
Book a DemoInstallSign in
Socket

@linzjs/docker-command

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@linzjs/docker-command

Run a command in either docker or on you local system

8.0.0
latest
Source
npmnpm
Version published
Weekly downloads
15
-11.76%
Maintainers
3
Weekly downloads
 
Created
Source

@linzjs/docker-command

Run a command in either docker or on you local system

import { Command } from '@linzjs/docker-command';

const cmd = new Command('echo', { container: 'ubuntu', tag: 'latest' });

// Spawn a docker container and run `echo hello world`
await cmd.create().arg('Hello World').run(); // {stdout: "Hello World\n"}
// Spawn a echo process and run `echo hello world`
await cmd.create({ useDocker: false }).arg('Hello World').run(); // {stdout: "Hello World\n"}

Mounting folders in docker

folders can be mounted into the docker container volumes with .mount

.mount(path) will create a single --volume path:path

import { Command } from '@linzjs/docker-command';

const proc = await Command.create('ls', { container: 'ubuntu' });
proc.mount('/home/blacha');
proc.arg('/home/blacha');

await proc.run(); // ls results for local /home/blacha

Passing environment variables

import { Command } from '@linzjs/docker-command';

const proc = await Command.create('env', { container: 'ubuntu' });
proc.env('AWS_ACCESS_KEY_ID'); // Load process.env.AWS_ACCESS_KEY_ID into docker
proc.env('AWS_ACCESS_KEY_ID', 'fakeKey'); // set a specific AWS_ACCESS_KEY_ID into docker

FAQs

Package last updated on 11 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.