Created
August 8, 2016 21:14
-
-
Save xbglowx/df3b359bebe76c03d98b93d793178969 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
#!/usr/bin/env python | |
import docker | |
cli = docker.Client(base_url='unix://var/run/docker.sock') | |
try: | |
response = cli.inspect_container(container='redis') | |
except docker.errors.NotFound: | |
pass | |
else: | |
cli.remove_container(container='redis', force=True) | |
cli.create_container( | |
image='redis', | |
name='redis', | |
host_config = { | |
'log_config': { | |
'type': 'json-file', | |
'config': {} | |
} | |
} | |
) | |
cli.start(container='redis') | |
response = cli.inspect_container(container='redis') | |
print response['HostConfig']['LogConfig'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment