Docker Compose Command-Wrapper (DCC)
The docker compose
command wrapper is a shortcut for the command docker compose
. On top of that it supports using different docker-compose.yml
files depending on the DCC_ENV
variable.
It will wrap the docker compose command like this:
$@
: these are all additional parameters you provide the dcc
command. For example, assuming the DCC_ENV
variable is dev
, if you type
the following command will be executed:
You can use all docker compose
command line arguments documented in the official documentation, except the special commands described below.
It also reads the .env
file every time the command is run and, if you are working in a git repository, it sets some git
related environment variables such as
GIT_VERSION=$(git describe --always)
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD
GIT_LASTCOMMITDATE=$(git log -1 --format=%cI)
GIT_COMMITHASH=$(git rev-parse HEAD)
Special commands
To shorthand often used commands the following shorthands are available:
ls
: lists all containers on the system with their statusrm
: removes all containers on the systemlg
: follow log filespo
: lists the exposed ports of all running containersnet
: show the network infrastructurerp
: lists the restart policy of all containersmt
: show mountsvol
: show volumesvolbkp
: backup a docker volume totar.gz
sh
: opens an interactive shell (bash) at a certain containerclean
: cleans the docker environment--help
or any docker compose command: https://docs.docker.com/compose/reference/
Installation
dcc
will be installed to~/.local/bin
. Make sure~/.local/bin
is in yourPATH
.