@yvnbunag/dock
v1.0.4
Published
A CLI tool to help manage and consume development environments containerized with docker
Downloads
45
Maintainers
Readme
@yvnbunag/dock
A CLI tool to help manage and consume development environments containerized with docker and configured with docker-compose
Contents
- When would I use dock?
- What docker orchestration engines are currently supported?
- Requirements
- Installation
- Configuration
- Usage
- Example Projects
- Contributing
- Exit Codes
- Repository
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
- Docker (for Linux) version 19.03 or higher
- 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
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
Disable completion
dock completion disable
register
Register project
Register current directory
dock register
Register provided path to directory
dock register [path]
projects
List registered projects
dock projects
use
Activate project for usage when invoking docker abstraction engine commands
dock use [project]
build
Build container/s or service container/s
Build all containers
dock build
Build specific container/s or service container/s
dock build [reference...]
install
Run install script/s for services
Run all install scripts
dock install
Run install scripts of specific service/s
dock install [service...]
up
Bring container/s or service container/s up
Bring up all containers
dock up
Bring up specific container/s or service container/s
dock up [reference...]
down
Stop and remove container/s or service container/s
Bring down all containers
dock down
Bring down specific container/s or service container/s
dock down [reference...]
mode
Switch running containers with provided mode container/s and service container/s
dock mode [mode...]
open
Open interactive shell of container or service container
Open container
dock open [container]
Open service container
dock open [service]
run
Run command in container or service container
Run command in container
dock run [container] [command...]
Run command in service container
dock run [service] [command...]
[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
Run command in service container
dock [service-command...]
reload
Reload used project
dock reload
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]
Example Projects
See Library System Stack repository for example configuration and usage
Contributing
Exit Codes
Repository
See Repository