Skip to content

soodkshitij/Docker-Py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Docker-Py

--> On the fly create docker containers.

--> Remote script execution inside created containers.

--> API's to create, run, pause, resume, stop, inspect and read remote script logs.

Build flask-lambda image using docker file.To use any other image change config.ini
Build egg or add project in pypath
Install docker sdk, flask and rocksdb

Post file

curl -i -X POST -H "Content-Type: multipart/form-data" -F "data=@test.py" http://localhost:5000/api/v1/scripts

Response:

{"response": {"script_id": 776}}

Create Container

GET : http://localhost:5000/api/v1/scripts/create-container/776

Response:

{"response": {"script_id": 776}, "container_state": "CREATED"}

Run container

GET : http://localhost:5000/api/v1/scripts/start-container/776

Response:

{"response": {"script_id": 776}, "container_state": "RUNNING"}

Read logs

GET : http://localhost:5000/api/v1/scripts/read-logs/776

Response:

{"response": {"script_id": 776}, "container_state": "RUNNING", "logs": "hello\r\nbye\r\n"}

Container Status

GET http://localhost:5000/api/v1/scripts/container-stats/776

Response:

{"response": {"script_id": "776"}, "container_state": "exited"}

Pause Container

GET http://localhost:5000/api/v1/scripts/pause-container/2567

Response:

{"response": {"script_id": 2567}, "container_state": "paused"}

Resume Container

GET http://localhost:5000/api/v1/scripts/resume-container/2567

Response:

{"response": {"script_id": "2567"}, "container_state": "running"}

Stop Container

GET http://localhost:5000/api/v1/scripts/stop-container/2567

Response:

{"response": {"script_id": 2567}, "container_state": "exited"}

Delete Container

GET http://localhost:5000/api/v1/scripts/delete-container/2567

Response:

{"response": {"script_id": "2567"}, "container_state": "DELETED"}

About

Create on the fly docker containers to run python code inside container

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages