Created
July 29, 2017 06:51
-
-
Save WoodProgrammer/f57fb5cc472273291bf5c917469d348f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import urllib2 | |
| import requests | |
| def awake_db(): | |
| payload = json.dumps({ | |
| "Hostname":"", | |
| "User":"", | |
| "Memory":0, | |
| "Memoryswap":0, | |
| "attachstdin":False, | |
| "attachstdout":True, | |
| "attachstderr":True, | |
| "privileged": False, | |
| "tty":False, | |
| "openstdin":False, | |
| "stdinonce":False, | |
| "Image":"mongo", | |
| "Volumes":{}, | |
| "Volumesdrom":"", | |
| "Workingdir":"" | |
| }) | |
| req = urllib2.Request('http://10.47.105.92:4243/containers/create') | |
| req.add_header('Content-Type', 'application/json') | |
| response = urllib2.urlopen(req, payload) | |
| container_meta_data = response.read() | |
| data = json.loads(container_meta_data) | |
| container_id = data['Id'] | |
| print container_id | |
| start_request = requests.post('http://10.47.105.92:4243/containers/{}/start'.format(container_id)) | |
| awake_db() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment