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
- Not tested on Docker Desktop (for Mac and Windows), but should still be applicable
- 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
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
Disable completion
dock completion disable
Expand to see recording
register
Register project
Register current directory
dock register
Expand to see recording
Register provided path to directory
dock register [path]
Expand to see recording
projects
List registered projects
dock projects
Expand to see recording
use
Activate project for usage when invoking docker abstraction engine commands
dock use [project]
Expand to see recording
build
Build container/s or service container/s
Build all containers
dock build
Expand to see recording
Build specific container/s or service container/s
dock build [reference...]
Expand to see recording
install
Run install script/s for services
Run all install scripts
dock install
Expand to see recording
Run install scripts of specific service/s
dock install [service...]
Expand to see recording
up
Bring container/s or service container/s up
Bring up all containers
dock up
Expand to see recording
Bring up specific container/s or service container/s
dock up [reference...]
Expand to see recording
down
Stop and remove container/s or service container/s
Bring down all containers
dock down
Expand to see recording
Bring down specific container/s or service container/s
dock down [reference...]
Expand to see recording
mode
Switch running containers with provided mode container/s and service container/s
dock mode [mode...]
Expand to see recording
open
Open interactive shell of container or service container
Open container
dock open [container]
Expand to see recording
Open service container
dock open [service]
Expand to see recording
run
Run command in container or service container
Run command in container
dock run [container] [command...]
Expand to see recording
Run command in service container
dock run [service] [command...]
Expand to see recording
[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
Run command in service container
dock [service-command...]
Expand to see recording
reload
Reload used project
dock reload
Expand to see recording
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
Example Projects
See Library System Stack repository for example configuration and usage
Contributing
Exit Codes
Repository
See Repository