Based on SCM Breeze, but for Docker!
This repo is a collection of helpful shell aliases and functions to make working with Docker faster, and smoother.
Who has time to write out
docker run -it --rm ...
every time you want to run a container!? Not me.
This CLI is currently available for bash
and zsh
via the installation script.
git clone https://github.com/taylorsweetman/docker-breeze.git ~/.docker_breeze
~/.docker_breeze/install.sh
source ~/.bashrc # or source "${ZDOTDIR:-$HOME}/.zshrc"
Note:
In order for Docker Breeze to work properly, your user must be a member of the docker group.
If this is not the case, run the following:
sudo groupadd docker
sudo gpasswd -a $USER docker
newgrp docker
-
d-c
➡️docker-compose
- Shortcut for the unfortunately verbose
docker-compose
command.
-
dps
➡️docker ps
- Lists all running containers.
-
dpsa
➡️docker ps -a
- Lists all containers, including stopped ones.
-
dcp
➡️docker container prune
- Prunes non-running containers.
-
dip
➡️docker image prune
- Prunes dangling images.
-
dils
➡️docker image ls
- Lists current images.
-
dirm <IMAGE_ID>
➡️docker image rm <IMAGE_ID>
- Removes the specified image.
-
db <IMAGE_NAME>
➡️docker build -t <IMAGE_NAME> .
- Builds a Docker image with <IMAGE_NAME> from the source code in the current working directory.
-
dbh
➡️docker build -t <CURRENT_DIR_NAME> .
- Builds a Docker image with the name of your current working directory, <CURRENT_DIR_NAME>.
- Uses the source code of your same working directory.
-
dri <IMAGE_NAME> <OPTIONAL_ARGS>
➡️docker run -it --rm <IMAGE_NAME> <OPTIONAL_ARGS>
- Runs a container in interactive mode based off image: <IMAGE_NAME>.
- Will pass <OPTIONAL_ARGS> to the container.
-
drih <OPTIONAL_ARGS>
➡️docker run -it --rm <CURRENT_DIR_NAME> <OPTIONAL_ARGS>
- Runs a container in interactive mode based off image with the name of the current directory <CURRENT_DIR_NAME>.
- Will pass <OPTIONAL_ARGS> to the container.
-
drd <IMAGE_NAME> <OPTIONAL_ARGS>
➡️docker run -d <IMAGE_NAME> <OPTIONAL_ARGS>
- Runs a container in detached mode based off image: <IMAGE_NAME>.
- Will pass <OPTIONAL_ARGS> to the container.
-
drdh <OPTIONAL_ARGS>
➡️docker run -d <CURRENT_DIR_NAME> <OPTIONAL_ARGS>
- Runs a container in detached mode with the name of the current directory <CURRENT_DIR_NAME>.
- Will pass <OPTIONAL_ARGS> to the container.