Skip to content

Instantly share code, notes, and snippets.

@thaJeztah
Last active December 12, 2021 00:05
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thaJeztah/340fe943e5f0426407eec32e22809ec4 to your computer and use it in GitHub Desktop.
Save thaJeztah/340fe943e5f0426407eec32e22809ec4 to your computer and use it in GitHub Desktop.
Docker Changelog CLI plugin

Docker Changelog CLI plugin

Based on a tweet by @Tomwillfixit

Just a quick fun conversion to make it work as a Docker CLI plugin

To use it (assuming you're running a beta of Docker 19.03):

  1. create the plugins directory

    mkdir -p ~/.docker/cli-plugins
  2. download the "plugin", and save it as ~/.docker/cli-plugins/docker-changelog (note: no .sh extension!)

    curl https://gist.githubusercontent.com/thaJeztah/340fe943e5f0426407eec32e22809ec4/raw/d843dab795c34fb703e780eb221ebe7075e0d3be/docker-changelog-plugin.sh > ~/.docker/cli-plugins/docker-changelog 
  3. make it executable

    chmod +x ~/.docker/cli-plugins/docker-changelog
  4. run the help command to verify the plugin was installed

    docker help
    ...
    Management Commands:
      app*        Docker Application (Docker Inc., v0.8.0-beta1)
      builder     Manage builds
      buildx*     Build with BuildKit (Docker Inc., v0.2.0-tp)
      changelog*  View the Docker Engine changelog (thaJeztah, v0.0.1)
  5. enjoy!

    docker changelog
    # Changelog
    
    For official release notes for Docker Engine CE and Docker Engine EE, visit the
    [release notes page](https://docs.docker.com/engine/release-notes/).
    
    ## 19.03.0 (2019-05-21)
#!/usr/bin/env bash
docker_cli_plugin_metadata() {
local vendor="thaJeztah"
local version="v0.0.1"
local url="https://twitter.com/tomwillfixit/status/1124462492804046848?s=11"
local description="View the Docker Engine changelog"
cat <<-EOF
{"SchemaVersion":"0.1.0","Vendor":"${vendor}","Version":"${version}","ShortDescription":"${description}","URL":"${url}"}
EOF
}
version() {
docker --version | cut -d " " -f 3 | cut -d "," -f 1
}
docker_changelog() {
curl -s "https://raw.githubusercontent.com/docker/docker-ce/v$(version)/CHANGELOG.md" | more
}
case "$1" in
docker-cli-plugin-metadata)
docker_cli_plugin_metadata
;;
*)
docker_changelog
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment