Skip to content

Instantly share code, notes, and snippets.

@heptal
Last active March 9, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heptal/813c6f618f58174da6f0 to your computer and use it in GitHub Desktop.
Save heptal/813c6f618f58174da6f0 to your computer and use it in GitHub Desktop.
Docker manager in Hammerspoon

Docker management menubar utility

Got tired of having to constantly manipulate the docker CLI commands for basic operations and for which the API has changed rapidly in the past year (much top-ranked info out there is out of date)

Assuming docker is installed (brew cask install dockertoolbox):

  • Start/stop/remove docker containers
  • Easily copy container IP to pasteboard addresses by just clicking
  • Conveniently open browser on container's exposed port
  • Open Kitematic GUI app included with dockertoolbox by clicking Docker

Get it here: docker.lua

Save as docker.lua in ~/.hammerspoon/ and put docker = require "docker" in your init.lua

I use lua-stdlib (installed with luarocks-5.3 install stdlib) for the keys function but you can just as easily have your own:

local keys = function(t)
  local keys={}
  for k, v in pairs(t) do
    table.insert(keys, k)
  end
  table.sort(keys)
  return keys
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment