Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Add Docker Compose rm support and YML PATH change
Browse files Browse the repository at this point in the history
Added support for `docker-compose rm` and also added a environment DOCKER_COMPOSE_UI_YML_PATH for override YML project path, instead of forced mapping to /opt/
  • Loading branch information
tarunlalwani committed May 23, 2016
1 parent ef0472e commit 3df6bc4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.py
Expand Up @@ -17,7 +17,7 @@

# Flask Application
API_V1 = '/api/v1/'
YML_PATH = '/opt/docker-compose-projects'
YML_PATH = os.getenv('DOCKER_COMPOSE_UI_YML_PATH') or '/opt/docker-compose-projects'
logging.basicConfig(level=logging.DEBUG)
app = Flask(__name__, static_url_path='')

Expand Down Expand Up @@ -48,6 +48,16 @@ def list_projects():
active = [container['Labels']['com.docker.compose.project'] for container in containers()]
return jsonify(projects=projects, active=active)

@app.route(API_V1 + "remove/<name>", methods=['DELETE'])
@requires_auth
def rm(name):
"""
remove previous cached containers. docker-compose rm -f
"""
pro = get_project_with_name(name)
pro.remove_stopped()
return jsonify(command='rm')

@app.route(API_V1 + "projects/<name>", methods=['GET'])
def project_containers(name):
"""
Expand Down

0 comments on commit 3df6bc4

Please sign in to comment.