1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-18 03:21:36 +02:00

Move docker related features to a separate module

This commit is contained in:
Pierre Jaury 2016-11-09 16:38:17 +01:00
parent 4246179b88
commit bbf71b262e
2 changed files with 1 additions and 11 deletions

View File

@ -51,9 +51,6 @@ scheduler = background.BackgroundScheduler()
manager = flask_script.Manager(app)
manager.add_command('db', flask_migrate.MigrateCommand)
# Connect to the Docker socket
dockercli = docker.Client(base_url=app.config['DOCKER_SOCKET'])
# Task scheduling
if not app.debug or os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
scheduler.start()

View File

@ -34,15 +34,8 @@ def logout():
@app.route('/services', methods=['GET'])
@access.global_admin
def services():
containers = {}
try:
all_containers = dockercli.containers(all=True)
containers = dockercli.get()
except Exception as error:
return flask.render_template('docker-error.html', error=error)
for brief in all_containers:
if brief['Image'].startswith('mailu/'):
container = dockercli.inspect_container(brief['Id'])
container['Image'] = dockercli.inspect_image(container['Image'])
name = container['Config']['Labels']['com.docker.compose.service']
containers[name] = container
return flask.render_template('services.html', containers=containers)