{ "info": { "author": "Damien Ramunno-Johnson", "author_email": "damien@squareup.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "- [pydocker](#pydocker)\n- [Setup](#setup)\n - [Docker setup](#docker-setup)\n - [Build Example Image](#build-example-image)\n - [Install pydocker](#install-pydocker)\n - [Setup pydocker](#setup-pydocker)\n- [Using pydocker](#using-pydocker)\n - [Start ssh-agent container](#start-ssh-agent-container)\n - [Launch](#launch)\n - [Google Cloud Setup (optional)](#google-cloud-setup-optional)\n - [Status Server](#status-server)\n - [Development](#development)\n - [Setup](#setup-1)\n - [Tests](#tests)\n - [Continuous Integrations](#continuous-integrations)\n - [Versions and Tags](#versions-and-tags)\n - [License](#license)\n\n\n# pydocker\nThis goal of **pydocker** is to make it seamless to work on a docker container on your laptop like you would with your normal environment. This means it handles passing all of your credentials (SSH key, Google, etc) and mounting a directory of your choosing from the host machine to the container, and sets up port forwarding so that you can still use notebooks. It supports local images, Google Container Repository, or anywhere docker can pull from.\n\n# Setup\n\n**(Note: These instructions currently only support MacBooks but pydocker should work on other OS.)**\n\nBefore you install the library there are some minimal environment setup steps.\n\n\n\n## Docker setup\n\nInstall and start Docker:\n\n```\nbrew cask install docker\nopen /Applications/Docker.app\n```\n\n## Build Example Image\n**Dockerfile**\n```dockerfile\nFROM google/cloud-sdk:slim\nRUN pip install jupyterlab notebook pandas\nRUN /bin/echo -e '#!/bin/bash\\njupyter notebook --notebook-dir=\"/\" --ip=0.0.0.0 --allow-root --NotebookApp.token=\"\"' > /usr/bin/notebook && \\\n chmod +x /usr/bin/notebook && \\\n /bin/echo -e '#!/bin/bash\\njupyter lab --notebook-dir=\"/\" --ip=0.0.0.0 --allow-root --NotebookApp.token=\"\"' > /usr/bin/lab && \\\n chmod +x /usr/bin/lab\nWORKDIR /current\nCMD notebook\n```\nThis Dockerfile uses the current directory as the workspace, and will look for all files there and the build command, `docker build -t notebook -f Dockerfile .`, will create a local docker image called **Notebook**, which uses the *google/cloud-sdk* as a base image. The Dockerfile also then makes a couple of small scripts to make it easier to launch notebooks or jupyterlab.\n\n\n## Install pydocker\n\n```\npip install sq-pydocker\n```\n\n\n## Setup pydocker\nMake the directory\n```\npydocker init\n```\nThis will copy your ssh keys, and create a new config based on your main square config, but modified because of running in a docker container. This only needs to be run the first time.\n\n\n# Using pydocker\n```\nUsage: pydocker [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n -v, --verbose\n --help Show this message and exit.\n\nCommands:\n agent\n init\n launch\n status\n```\n\n\n\n## Start ssh-agent container\nIf you need to have the ability to ssh into machines you can start an ssh-agent in a container with:\n```python\npydocker agent\n```\nThis will add keys copied with the `init` command without passwords automatically, or print the command you need to run to add password protected keys. This `ssh-agent` container will then be connected to all other containers, so you don't need to keep entering your key password. The makes it more secure by not storing any credentials in the Image. This container can be restarted when needed, if you run `pydocker agent` it will delete the container, and make a new one.\n\n\n## Launch\n```\nOptions:\n -i, --image TEXT Docker image\n -n, --name TEXT container name\n -d, --working-dir TEXT host directory to mount\n -p, --port INTEGER local port to be connected to container\n -l, --logs stream container logs\n --gcloud / --no-gcloud include gcloud credentials\n -c, --command TEXT command which is passed to container\n --help show this message and exit.\n```\n\nThis command launches the notebook (which we built above) and forwards internal port 8888 to the laptops port 9000 and creates a container named test. In addition the host's current folder `.` is mounted in the **working-dir** folder. This gives the container access to the host filesystem. After running the command you can go to `localhost:9000` in your browser.\n\n```\npydocker launch --image notebook --name test --working-dir . --port 9000 --no-gcloud\n```\n\nRemote images also work:\n```\npydocker launch --image jupyter/minimal-notebook:latest --name example --working-dir . --port 9000 --no-gcloud\n```\nWill pull the remote image down first. You can still do `docker pull IMAGE` and pydocker will use the already downloaded image.\n\n### Google Cloud Setup (optional)\nThis is only required if you are going to be using Google Cloud. If you already have gcloud installed, update by running `gcloud components update`. If you have not setup Google Cloud already, begin by installing Google Cloud.\n\n 1. Download the (archive)(https://cloud.google.com/sdk/docs/quickstart-mac-os-x) and unpack it (only do the \"Before you begin\" section).\n\n 2. Navigate to the folder containing `google-cloud-sdk` and run\n```bash\n./google-cloud-sdk/install.sh\n```\n\n 3. Set your gcloud account and project.\n```bash\ngcloud auth login\ngcloud config set account ${USER}@squareup.com\ngcloud config set project YOUR_PROJECT\ngcloud auth application-default login\n```\n\n 4. Now generate your ssh credentials by running:\n```bash\ngcloud compute ssh --zone \"us-central1-a\" \"RUNNING_VM\"\n```\n\n## Status Server\n```bash\npydocker status\n```\nThis will open a status server which will show a page with information about all local containers. This includes a link to clink into any with open port forwarding.\n\n![Container Status](status.png \"Container Status\")\n\n\n## Development\n\n### Setup\n\n`pip install -e .`\n\n### Tests\n\n* `pytest` runs the unit tests\n* `flake8` to check style guidelines\n\nTo run them locally:\n\n flake8 .\n pytest\n\n### Continuous Integrations\nCI is handled through travis, and will run non-GCS tests on both 2.7 and 3.6.\nWe may add cloud storage tests to travis soon, but for now tests should also be\nrun locally to confirm that functionality works as well.\n\n\n### Versions and Tags\nUse bumpversion to update the version of the package\n\n bumpversion [major|minor|patch]\n\nThis will increment the version and update it both in `setup.py` and `pydocker/__init__.py`.\nIt will also automatically commit a tag with the corresponding version. You can push this to the repo\nwith\n\n git push --tags\n\n\n## License\n\nCopyright 2018 Square, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "pydocker", "license": "", "maintainer": "", "maintainer_email": "", "name": "sq-pydocker", "package_url": "https://pypi.org/project/sq-pydocker/", "platform": "", "project_url": "https://pypi.org/project/sq-pydocker/", "project_urls": null, "release_url": "https://pypi.org/project/sq-pydocker/0.3.2/", "requires_dist": null, "requires_python": "", "summary": "Python package to make it easier to manage docker containers", "version": "0.3.2" }, "last_serial": 5875054, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "a88a20ec4241fbd7d6ab3709edc67609", "sha256": "544b5b14dea619c968bcfc913ae5effa0e4e7ba7c5c7191b41cbc10d3203db1f" }, "downloads": -1, "filename": "sq-pydocker-0.2.1.tar.gz", "has_sig": false, "md5_digest": "a88a20ec4241fbd7d6ab3709edc67609", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12918, "upload_time": "2019-06-18T21:09:40", "url": "https://files.pythonhosted.org/packages/84/47/505cb81f2ca22d4d7352634b7a12b9f0019d738152b50c645dfc2736551b/sq-pydocker-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "96f9faded006d49a97189c23964993b3", "sha256": "8358c4366b17391d457afe8b3e9ff0ea98e45fde3a25aa44cdee2a98cf4c8aa0" }, "downloads": -1, "filename": "sq-pydocker-0.2.2.tar.gz", "has_sig": false, "md5_digest": "96f9faded006d49a97189c23964993b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10165, "upload_time": "2019-07-13T22:16:46", "url": "https://files.pythonhosted.org/packages/81/d8/426a1c8272fbca237e2ce41bb912435f976083adc7abced93e42c33d9fee/sq-pydocker-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "c5a4953c500e2f7c2069cc097045d669", "sha256": "8be6f4e23e3fb1abda30245bafe37f5061462a2d619afc76d0564c4c33961d6d" }, "downloads": -1, "filename": "sq-pydocker-0.2.3.tar.gz", "has_sig": false, "md5_digest": "c5a4953c500e2f7c2069cc097045d669", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12981, "upload_time": "2019-07-18T14:13:10", "url": "https://files.pythonhosted.org/packages/03/2f/04df0a79f4cfd3ed51445fc8870c0a8af139561935b07a88f7a9e66e4921/sq-pydocker-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "ab7d1bb44475a2372aac47af97e10f8c", "sha256": "37e68088488fd197c47dace5328b198af4c3431a7d5a58f9b8ef541993046827" }, "downloads": -1, "filename": "sq-pydocker-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ab7d1bb44475a2372aac47af97e10f8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13283, "upload_time": "2019-08-22T22:56:15", "url": "https://files.pythonhosted.org/packages/b6/fb/7a700c52306e2e3aad864c4e3113f9bb6c8d8cd9421962fef4a7a279fce5/sq-pydocker-0.3.0.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "aba197f6fec09361c2a8c1a6c63b7e4a", "sha256": "3925bba9d4aa5c9ea6d96ec0ee4c77e1de961ff2781f5728966487faa3e3689a" }, "downloads": -1, "filename": "sq-pydocker-0.3.2.tar.gz", "has_sig": false, "md5_digest": "aba197f6fec09361c2a8c1a6c63b7e4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15109, "upload_time": "2019-09-23T17:48:25", "url": "https://files.pythonhosted.org/packages/bc/c5/f784099f3c4075dc834ead0625cbcd409a5dbaf87c70ce1b491fd8b73db1/sq-pydocker-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aba197f6fec09361c2a8c1a6c63b7e4a", "sha256": "3925bba9d4aa5c9ea6d96ec0ee4c77e1de961ff2781f5728966487faa3e3689a" }, "downloads": -1, "filename": "sq-pydocker-0.3.2.tar.gz", "has_sig": false, "md5_digest": "aba197f6fec09361c2a8c1a6c63b7e4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15109, "upload_time": "2019-09-23T17:48:25", "url": "https://files.pythonhosted.org/packages/bc/c5/f784099f3c4075dc834ead0625cbcd409a5dbaf87c70ce1b491fd8b73db1/sq-pydocker-0.3.2.tar.gz" } ] }