Skip to content

gist-github/docker-cli-sugar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker CLI Sugar

A variety of command line tools to help with common docker tasks.

These commands require bash on the host, but support containers with bash and/or just sh.

Install

Requires bash.

git clone https://github.com/avirshup/docker-cli-sugar
export PATH=$(pwd)/docker-cli-sugar:${PATH}

# Enable for all your bash sessions:
echo "export PATH=$(pwd)/docker-cli-sugar:${PATH}" >> ~/.bash_profile

The commands

dshell [image-or-container-name-or-id]

Launch a shell in an image or container (whether running or stopped). Launches bash by preference, otherwise sh.

Shell in a running container

[host]$ docker run -d --name "running-container" alpine sleep 10000
[host]$ dshell running-container
Running 'docker exec  -it running-container [...]'
shell: sh
[container]$ apk update  # or whatever
[...]

Shell in an image

[host]$ dshell centos
Running "docker run -it --entrypoint=sh centos"
shell: bash
[container]$ yum update  # or whatever
[...]

Examining a stopped container

[host]$ docker run --name "stopped-container" \
             alpine sh -c "echo hello world > hello.txt"
[host]$ dshell stopped-container
Container is stopped. Committing to image
Running "docker commit stopped-container dshell-temp-container"
sha256:[...]
Running "docker run --entrypoint=sh -it dshell-temp-container"
[container]$ ls
hello.txt
[container]$ cat hello.txt
hello world

drm [images-and-container-ids] [arguments for docker rmi]

Remove images and/or containers

Example

[host]$ docker run alpine echo hello world --name removeme
[host]$ drm alpine removeme

dps

Alias for docker ps

dim

Alias for docker images

dstats

Alias for docker stats

About

Various CLI shortcuts for common docker operations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%