Skip to content

Instantly share code, notes, and snippets.

@xbglowx
Created August 8, 2016 21:14
Show Gist options
  • Save xbglowx/df3b359bebe76c03d98b93d793178969 to your computer and use it in GitHub Desktop.
Save xbglowx/df3b359bebe76c03d98b93d793178969 to your computer and use it in GitHub Desktop.
#!/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