Tool for easier switching between projects that uses docker containers to set up working environment
pip install dockswapUsage: 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 dockswapUsage: 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 fileUsage: dockswap list [OPTIONS]
List all registered composers
Options:
--full / --no-full show more info [default: False]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]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