Skip to content

VagifMammadaliyev/dockswap

Repository files navigation

DockSwap

Tool for easier switching between projects that uses docker containers to set up working environment

Installation

pip install dockswap

Usage

Usage: dockswap [OPTIONS] COMMAND [ARGS]...

DockSwap. Tool for swapping projects.

Commands:
  add      Register a composer for project
  delete   Delete registered composer
  list     List all registered composers
  prune    Prune existing registered composers.
  start    Start containers for registered composer
  stop     Stop containers for registered composer
  stopall  Stop (and/or remove) all running containers
  version  Show version of currently used dockswap

Adding composer

Usage: dockswap add [OPTIONS] PROJECT_NAME

  Register a composer for project

Arguments:
  PROJECT_NAME  [required]

Options:
  --path PATH      Path to .yml or .json file that must be run using docker-
                   compose  [required]

  --env-path PATH  If your docker-compose file uses env_file then specify path
                   for that file

Showing composers

Usage: dockswap list [OPTIONS]

  List all registered composers

Options:
  --full / --no-full  show more info  [default: False]

Starting

Usage: dockswap start [OPTIONS] PROJECT_NAME

  Start containers for registered composer

Arguments:
  PROJECT_NAME  [required]

Options:
  --remove-other / --no-remove-other
                                  Remove stopped containers  [default: False]
  --dry / --no-dry                Do not run command, instead just print it
                                  [default: False]

Why?

If your are using docker containers to set up your working environment then this tool is for you. I used to do like this:

$ cd ~/projects/foo
$ docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
$ docker-compose -f _dev/docker-compose.yml up -d

Then I want to switch to another project, and again:

$ cd ~/projects/bar
$ docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
$ docker-compose -f _directory_with_another_name/docker-compose.yml up -d

This is a bit verbose for such a simple task. Now what I do is just:

$ dockswap start foo --remove-other

About

Tool for easier switching between projects that uses docker containers to set up working environment

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors