Make docker URI part of config
This commit is contained in:
parent
e441c1fe91
commit
2884fc1eec
|
@ -4,6 +4,7 @@ import os
|
||||||
class Config:
|
class Config:
|
||||||
repository = os.environ['RESTIC_REPOSITORY']
|
repository = os.environ['RESTIC_REPOSITORY']
|
||||||
password = os.environ['RESTIC_PASSWORD']
|
password = os.environ['RESTIC_PASSWORD']
|
||||||
|
docker_base_url = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check(cls):
|
def check(cls):
|
||||||
|
|
|
@ -5,7 +5,6 @@ import pprint
|
||||||
|
|
||||||
from restic_volume_backup import utils
|
from restic_volume_backup import utils
|
||||||
|
|
||||||
DOCKER_BASE_URL = os.environ.get('DOCKER_BASE_URL') or "unix://tmp/docker.sock"
|
|
||||||
VOLUME_TYPE_BIND = "bind"
|
VOLUME_TYPE_BIND = "bind"
|
||||||
VOLUME_TYPE_VOLUME = "volume"
|
VOLUME_TYPE_VOLUME = "volume"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
import docker
|
import docker
|
||||||
|
import pprint
|
||||||
|
|
||||||
|
from restic_volume_backup.config import Config
|
||||||
|
|
||||||
|
|
||||||
def list_containers():
|
def list_containers():
|
||||||
client = docker.Client(base_url=DOCKER_BASE_URL)
|
client = docker.Client(base_url=Config.docker_base_url)
|
||||||
all_containers = client.containers()
|
all_containers = client.containers()
|
||||||
|
pprint.pprint(all_containers, indent=2)
|
||||||
client.close()
|
client.close()
|
||||||
return all_containers
|
return all_containers
|
||||||
|
|
Loading…
Reference in New Issue