Skip to main content

A CLI for working with docker on OSX

Project description

Build Status Documentation Status PyPI PyPI - License Code style: black

osxdocker

A CLI for working with docker on OSX

Currently it just handles docker logs, because I found it annoying starting up a screen session to get to the docker vm every time I wanted to clear logs. See: https://stackoverflow.com/questions/42527291/clear-logs-in-native-docker-on-mac

Install

# python3 only
pip3 install osxdocker

Dependencies

Assumes you have docker and screen installed. If you don't, you can easily install them through brew. e.g.

brew cask install docker
brew install screen

Usage

# clear logs
osxdocker clear_log $some_container_name

# list available commands and flags
osxdocker

clear_log_example

This cli uses https://github.com/google/python-fire
Check out the docs for more details on usage, setting up bash completion, etc.
Also worth noting:

  1. Because the package uses fire, it can be imported like a normal python package. e.g.
    from osxdocker.docker_logs import DockerLogs
    DockerLogs().log_path('foo')
    
  2. This cli doesn't support --version due to a quirk with fire.
    osxdocker version # works fine
    osxdocker --version # won't work
    

Edge cases and gotchas

Container names are unique, but containers are filtered by regex, so you can still run into issues.
e.g. You have two containers, named foo and foo_too.
osxdocker cat_log foo will fail because it matches foo and foo_too.
osxdocker cat_log ^foo$ will work because it matches foo exactly.

multiple_container_error

Developer notes

See docs/source/dev.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osxdocker-0.1.3.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

osxdocker-0.1.3-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page