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

Commit

Permalink
Start docker container if it already exists. Fix #199
Browse files Browse the repository at this point in the history
This is a workaround for an issue with startup sequence when we
have external volumes to mount.  In case of EC2 instance restart
the Docker daemon will start prior to taupage-init and will
immediately try to start the container it was running prior to
the restart.  This will fail because the volumes are not there yet,
they are mounted as part of taupage-init script, in 10-prepare-disks.py.

Starting the container explicitly "fixes" the problem because at that
point all required initialization steps are completed.
  • Loading branch information
a1exsh committed May 4, 2016
1 parent aa03f4d commit 63714cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion runtime/opt/taupage/runtime/Docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,16 @@ def main(args):
logging.error("Failed to list existing docker containers: %s", str(e))
# not a fatal error, continue

if not already_exists:
if already_exists:
try:
cmd = ['docker', 'start', 'taupageapp']
logging.info('Starting existing Docker container: {}'.format(cmd))
if not args.dry_run:
subprocess.check_output(cmd)
except Exception as e:
logging.error('Docker start of existing container failed: %s', str(e))
sys.exit(1)
else:
registry = extract_registry(source)

if registry:
Expand Down

0 comments on commit 63714cc

Please sign in to comment.