Behind the flyer: Using Docker with Python

https://github.com/dotcloud/docker-py

> sudo pip install docker-py
..
> python
>>> import docker
>>> c = docker.Client(base_url='unix://var/run/docker.sock', version='1.8', timeout=10)
>>> c.info()
{u'KernelVersion': u'3.2.0-4-amd64', u'NFd': 10, u'MemoryLimit': 0, u'InitSha1': u'', u'SwapLimit': 0, u'Driver': u'aufs', u'IndexServerAddress': u'https://index.docker.io/v1/', u'NGoroutines': 15, u'Images': 109, u'InitPath': u'/usr/local/bin/docker', u'Containers': 11, u'LXCVersion': u'0.8.0-rc1', u'Debug': 0, u'NEventsListener': 221, u'DriverStatus': [[u'Root Dir', u'/var/lib/docker/aufs'], [u'Dirs', u'135']], u'IPv4Forwarding': 1}
>>> help(c.containers)
Help on method containers in module docker.client:

containers(self, quiet=False, all=False, trunc=True, latest=False, since=None, before=None, limit=-1) method of docker.client.Client instance

(Caution:The above location is displayed in LESS or changes depending on the environment)
>>> c.containers(all=True)
[{u'Command': u'do not look at me',
  u'Created': 1391059918,
  u'Id': u'97115535aacbba9fcf19bbd9bc8ca9aac66132f79acf2820d6225a554b06191d',
  u'Image': u'griflet:oajxuu024euvttj0ar0s-23b235cf82b0301f864f6ad100a2b3245b7dca7d',
  u'Names': [u'/drunk_heisenberg'],
  u'Ports': None,
  u'SizeRootFs': 0,
  u'SizeRw': 0,
  u'Status': u'Exit 0'},
 {u'Command': u'do not look at me',
  u'Created': 1391059896,
  u'Id': u'5c796656a414673ead3c74aaafd95ae6f80c00125eda8cf01ea826b76eca7586',
  u'Image': u'54055ba1f6fe',
  u'Names': [u'/pensive_galileo'],
  u'Ports': None,
  u'SizeRootFs': 0,
  u'SizeRw': 0,
  u'Status': u'Exit 0'},
 {u'Command': u'do NOT look at me :-)',
..

(docker ps basically)

In ipython, if you insert Tab after "c.", Candidates will appear, so it may be easier to understand than a half-finished shell environment.

Recommended Posts

Behind the flyer: Using Docker with Python
Working with OpenStack using the Python SDK
Use python with docker
Prepare the execution environment of Python3 with Docker
[S3] CRUD with S3 using Python [Python]
Using Quaternion with Python ~ numpy-quaternion ~
[Python] Using OpenCV with Python (Basic)
Prepare python3 environment with Docker
Call the API with python3.
Using OpenCV with Python @Mac
Send using Python with Gmail
I tried using the Python library from Ruby with PyCall
[Python] LASSO regression with equation constraints using the multiplier method
Touch NoSQL with Python using the Oracle NoSQL Database Cloud Simulator
Complement python with emacs using company-jedi
Extract the xz file with python
[Python] Using OpenCV with Python (Image Filtering)
Using Rstan from Python with PypeR
[Python] Using OpenCV with Python (Image transformation)
[Python] Using OpenCV with Python (Edge Detection)
Build Mysql + Python environment with docker
Get the weather with Python requests
Get the weather with Python requests 2
Find the Levenshtein Distance with python
Hit the Etherpad-lite API with Python
Install the Python plugin with Netbeans 8.0.2
I liked the tweet with python. ..
Using cgo with the go command
Extract the targz file using python
Notes on using rstrip with python.
Master the type with Python [Python 3.9 compatible]
Try using the Python Cmd module
Application development with Docker + Python + Flask
When using MeCab with virtualenv python
Precautions when using six with Python 2.5
[In-Database Python Analysis Tutorial with SQL Server 2017] Step 6: Using the model
Access the Docker Remote API with Requests
[AWS] Using ini files with Lambda [Python]
Try using the Wunderlist API in Python
[Python] Set the graph range with matplotlib
Build Jupyter Lab (Python) environment with Docker
Try mathematical formulas using Σ with python
Try using the Kraken API in Python
Using venv in Windows + Docker environment [Python]
Using Python and MeCab with Azure Databricks
Check the existence of the file with python
Try using the camera with Python's OpenCV
Socket communication using socketserver with python now
[FX] Hit oanda-API in Python using Docker
[Python] Get the variable name with str
[Python] Round up with just the operator
Display Python 3 in the browser with MAMP
Tweet using the Twitter API in Python
Search the maze with the python A * algorithm
Connect to MySQL with Python within Docker
Try using Python with Google Cloud Functions
Let's read the RINEX file with Python ①
Use cryptography library cryptography with Docker Python image
Check stock prices with slackbot using python
Create Python + uWSGI + Nginx environment with Docker
Tips for using python + caffe with TSUBAME