Skip to main content

Docker API to create and list container/s

Project description


Run container via API and get running containers


.. image:: https://img.shields.io/codecov/c/github/codecov/example-python.svg

  • createJson.py - Script create Json output(docker ps execute outout) from running containers.
  • echoTest.py - Simple API to learn.
  • dockerApi.py - This script must be executed in the Web server or Flask default web server.

===== Usage

Requirements: Python2.7 or Python3.4 with flask must be installed:

Syntax:

.. code-block:: bash

# pip install flask
# git clone https://github.com/jamalshahverdiev/python-general-codes.git
# cd python-general-codes/simple-docker-flask-api
# ./dockerApi.py

..

  • Get contaner status with the name web:

.. code-block:: bash

# curl http://10.1.42.201/getcontainer?name=web

..

  • Get status of all running containers:

.. code-block:: bash

# curl http://10.1.42.201/getRunningContainers

..

  • Create new container with the payload data from jsondata.json file. In the JSON file we must define values of the needed fields.
  • imagename - in the value must be defined image name from https://hub.docker.com
  • containername - in the value must be defined container name which will be executed in the server
  • exposedPort - in the value must be defined the port number which will be exposed to the Host OS

.. code-block:: bash

# curl -v -s -XPOST -H "Content-type: application/json" http://10.1.42.201/createcontainer -d @jsondata.json

..

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dckrctrrunlist-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file dckrctrrunlist-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dckrctrrunlist-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for dckrctrrunlist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fa9819be9ce1d336bec681e8d1dfa63b627c02dbdc14c4b3cabe664ae9a2fad
MD5 cce8fc5463cd7b3518fba765502727e0
BLAKE2b-256 2248c624b08c7a8657b117b4278a00fde8db7eb7d443ec5f49b14c7e61d6811a

See more details on using hashes here.

Supported by

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