Skip to content

unixorn/docker-helpers.zshplugin

Repository files navigation

Docker helper scripts

License Awesomebot mega-linter GitHub stars

Table of Contents

This is a collection of docker helper scripts, packaged as a ZSH plugin to make it easier to use with frameworks like zgenom and antigen.

Most of these were collected from blog posts, gists, slack - basically stuff I saw and thought was useful enough to stash away, and I've given credit where I know the source.

If you wrote something I've collected and I didn't credit you, please create an issue or PR so I can correct it.

Script list

Command Description Credit
boot2docker-timesync boot2docker drifts out of time sync every time my MacBook Pro sleeps. Run this to resync.
dive Wrapper script that calls wagoodman/dive to analyze a container image.
docker-check-for-image-update Check if a given image has been updated, and if so, run a command. Matthias Lohr's blog
docker-container-volumes List the volumes attached to a container. http://www.tech-d.net/2014/05/05/docker-quicktip-5-backing-up-volumes/)
docker-create-backup-container Creates a container with all the volumes from all the containers on the host. From http://www.tech-d.net/2014/05/05/docker-quicktip-5-backing-up-volumes/
docker-delete-stopped-containers Cleans up stale stopped containers.
docker-here Builds an ephemeral container, runs it with the parameters you pass docker-here, then deletes the ephemeral container.
docker-ip Gets the pid of a running container.
docker-last Print the id of the last container you ran.
docker-lint Lint a Dockerfile with hadolint.
docker-pid Print pid of a running container.
docker-ps-cleanup Cleans up docker ps output by deleting all exited containers.
docker-purge-unnamed-images Cleans up image cruft by deleting all the images that aren't named.
docker-remove-dangling-images Cleans up image cruft by deleting all dangling images.
docker-runc Uses fzf to select an image and run a command in it.
docker-runinc Uses fzf to select a running container and run a command inside it.
docker-shell Runs a shell inside a container with pwd mounted as /pwd. Defaults to bash inside debian:buster-slim, reads shell & image name from STANDARD_DOCKER_COMMAND and STANDARD_DOCKER_IMAGE or $1 and $2.
docker-showipc Show the IP of a running docker container.
docker-stopc Stops and/or removes a docker container.
docker-superclean Clear out any stopped containers or stale images.
docker-update-all-images Update all images on the machine.
fzf-docker-attach Use fzf to select a docker container to start and attach to
fzf-docker-rm Use fzf to select a docker container to remove
fzf-docker-stop Use fzf to select a docker container to stop

Installing

Pre-Requisites

No matter how you choose to install the plugin, it has the following pre-requisites:

  • jq - Install with brew install jq
  • fzf - Install with brew install fzf

zgenom

Add zgenom load unixorn/docker-helpers.zshplugin to your .zshrc wherever you're loading your other plugins.

Antigen

Add antigen bundle unixorn/docker-helpers.zshplugin to your .zshrc with your other plugins. You can test drive them without editing your .zshrc by running antigen bundle unixorn/docker-helpers.zshplugin in a running zsh session.

Oh-My-Zsh

  1. cd to your oh-my-zsh plugins directory (~/.oh-my-zsh/custom/plugins)
  2. git clone https://github.com/unixorn/docker-helpers.zshplugin docker-helpers
  3. Add docker-helpers to your plugins in your .zshrc
...
plugins=( ... docker-helpers ...)
...

Other useful Docker stuff

  • If you use Sublime Text 2/3, check out sublime-docker. Lets you build inside Docker containers directly from Sublime Text.
  • dive - A tool for exploring a docker image, layer contents, and discovering ways to shrink your Docker image size.

About

Miscellaneous utility scripts and aliases for use with Docker.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages