powerline-docker
powerline-docker copied to clipboard
A Powerline segment for showing the status of your Docker containers
Powerline Docker 
A Powerline segment for showing the status of your Docker containers.
This segment shows the number of running, paused, exited, and restarting containers together with a nice looking whale. Please feel free to propose more features and give me ideas on how to improve it.

Glossary
-
●
: n containers running -
~
: n containers paused -
✖
: n containers exited -
↻
: n containers restarting
Requirements
The Docker segment requires docker and docker-py.
Installation
Installing the Docker segment can be done with pip
:
$ pip install powerline-docker
The Docker segment uses a couple of custom highlight groups. You'll need to define those groups in your colorscheme, for example in .config/powerline/colorschemes/default.json
:
{
"groups": {
"docker": { "fg": "gray8", "bg": "darkestblue", "attrs": [] },
"docker_running": { "fg": "green", "bg": "darkestblue", "attrs": [] },
"docker_paused": { "fg": "brightestorange", "bg": "darkestblue", "attrs": [] },
"docker_exited": { "fg": "brightred", "bg": "darkestblue", "attrs": [] },
"docker_restarting": { "fg": "gray10", "bg": "darkestblue", "attrs": [] },
"docker:divider": { "fg": "gray4", "bg": "darkestblue", "attrs": [] }
}
}
Then you can activate the Docker segment by adding it to your segment configuration, for example in .config/powerline/themes/shell/default.json
:
{
"function": "powerline_docker.docker",
"priority": 30
}
By default the segment tries to connect to the Docker engine at unix://var/run/docker.sock
, which is where it lives on most Unix systems. If your Docker engine is not living there, you can change the URL with the base_url
argument. You can also change the timeout
for API calls, which is set to 2 seconds by default.
The following configuration enables TLS and works with Docker Machine.
{
"function": "powerline_docker.docker",
"priority": 30,
"args": {
"base_url": "tcp://192.168.99.100:2376",
"timeout": 2,
"use_tls": true,
"ca_cert": "/path/to/ca.pem",
"client_cert": "/path/to/cert.pem",
"client_key": "/path/to/key.pem"
}
}
License
Licensed under the MIT License.
Inspired by powerline-gitstatus.