@yvnbunag/dock

1.0.4 • Public • Published

@yvnbunag/dock

@yvnbunag/dock


npm version nodejs version codecov npms.io (quality) Known Vulnerabilities Continuous Integration Continuous Delivery license

A CLI tool to help manage and consume development environments containerized with docker and configured with docker-compose



Contents



When would I use dock?

  • If you need to manage your containerized development environment globally
  • If you need ease when managing your containers via CLI only due to limited development machine resources
    • When having to bring up or down specific containers for services currently being developed
    • When occasionally running commands in a container, without having to remember the engine command and options needed


What docker orchestration engines are currently supported?

Only docker-compose. Other engines may be readily supported



Requirements

  1. Docker (for Linux) version 19.03 or higher
  2. Docker Compose version 1.27 or higher


Installation

Globally with npm

npm install -g @yvnbunag/dock

Globally with yarn

yarn global add @yvnbunag/dock


Configuration

Before a project may be registered and used with dock, a dock configuration (dock.config.yml) must be present in the project directory, along with the docker-compose configuration

See Configuration Reference

Expand to see example configuration from Library System Stack
name: library-system

containers:
  nginx:
    shell: sh
  mysql: {}
  node16:
    shell: sh

services:
  library-system:
    container: node16
    entry-point: ./applications/library-system
    install:
      - yarn
      - cp /shared/applications/library-system/.env .env
  library-system-api:
    container: node16
    entry-point: ./microservices/library-system-api
    install:
      - yarn
      - cp /shared/microservices/library-system-api/.env .env
      - yarn database:sync
      - yarn database:seed

modes:
  front-end:
    containers:
      - nginx
    services:
      - library-system
  back-end:
    containers:
      - nginx
      - mysql
    services:
      - library-system-api
  full-stack:
    containers:
      - nginx
      - mysql
    services:
      - library-system
      - library-system-api


Usage

Listed below are the commands to help you manage your development environments. You may use the built in help command for additional options and information

dock --help

# Or for specific commands
dock [command] --help

The dock command may be invoked without a sub command. See [root] command usage reference


completion

Show instructions to enable/disable dock completion

Enable completion

dock completion enable
Expand to see recording

Enable completion

Disable completion

dock completion disable
Expand to see recording

Disable completion


register

Register project

Register current directory

dock register
Expand to see recording

Register current directory

Register provided path to directory

dock register [path]
Expand to see recording

Register provided directory


projects

List registered projects

dock projects
Expand to see recording

List projects


use

Activate project for usage when invoking docker abstraction engine commands

dock use [project]
Expand to see recording

Use project


build

Build container/s or service container/s

Build all containers

dock build
Expand to see recording

Build all containers

Build specific container/s or service container/s

dock build [reference...]
Expand to see recording

Build specific references


install

Run install script/s for services

Run all install scripts

dock install
Expand to see recording

Build all containers

Run install scripts of specific service/s

dock install [service...]
Expand to see recording

Build specific references


up

Bring container/s or service container/s up

Bring up all containers

dock up
Expand to see recording

Bring up all containers

Bring up specific container/s or service container/s

dock up [reference...]
Expand to see recording

Bring up specific references


down

Stop and remove container/s or service container/s

Bring down all containers

dock down
Expand to see recording

Bring down all containers

Bring down specific container/s or service container/s

dock down [reference...]
Expand to see recording

Bring down specific references


mode

Switch running containers with provided mode container/s and service container/s

dock mode [mode...]
Expand to see recording

Switch to mode


open

Open interactive shell of container or service container

Open container

dock open [container]
Expand to see recording

Open container

Open service container

dock open [service]
Expand to see recording

Open service container


run

Run command in container or service container

Run command in container

dock run [container] [command...]
Expand to see recording

Run command in container

Run command in service container

dock run [service] [command...]
Expand to see recording

Run command in service container


[root]

Given that the first argument is not a command and current directory is a service reference:

  • Open interactive shell of service container if no arguments are provided
  • Run command in service container if arguments are provided

Open service container

dock
Expand to see recording

Open service container

Run command in service container

dock [service-command...]
Expand to see recording

Run command in service container


reload

Reload used project

dock reload
Expand to see recording

Reload used project

Command not needed to be used for every new change in the configuration file as project gets automatically reloaded every time a orchestration engine command is invoked


unregister

Unregister project

dock unregister [project]
Expand to see recording

Unregister project



Example Projects

See Library System Stack repository for example configuration and usage



Contributing

See Contributing Guide



Exit Codes

See Exit Codes Reference



Repository

See Repository

Package Sidebar

Install

npm i @yvnbunag/dock

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

128 kB

Total Files

10

Last publish

Collaborators

  • yvnbunag