Skip to main content

A CLI for working with docker on OSX

Project description

Build Status PyPI PyPI - License Code style: black GitHub Pipenv locked Python version

osxdocker

A CLI for working with docker on OSX

Currently it only 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

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 details

Dev Install

# install dev dependencies
pipenv install --dev

# install osxdocker as symlink to avoid reinstall whenever code changes
pipenv run dev_install

# only runs from pipenv in dev
pipenv run osxdocker 

Test pypi install

# install from test pypi, allow pull from non-test pypi for fire
pip3 install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple osxdocker

Dev tools

Deploy

https://github.com/takluyver/flit/ manages building and deploying

# build dist
pipenv run flit build

# publish to test pypi
pipenv run publish_test

# really publish
pipenv run publish

Tests

pipenv run tests

Linter

# to autoformat python code
pipenv run lint

# to sort imports
pipenv run isort -y

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.0.tar.gz (156.6 kB view hashes)

Uploaded Source

Built Distribution

osxdocker-0.1.0-py3-none-any.whl (6.1 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