@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' });
await cmd.create().arg('Hello World').run();
await cmd.create({ useDocker: false }).arg('Hello World').run();
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();
Passing environment variables
import { Command } from '@linzjs/docker-command';
const proc = await Command.create('env', { container: 'ubuntu' });
proc.env('AWS_ACCESS_KEY_ID');
proc.env('AWS_ACCESS_KEY_ID', 'fakeKey');