Merge pull request #2547 from seguins/1125-docker-compose-create
Add docker-compose create command.
This commit is contained in:
commit
a2d2915a64
6 changed files with 179 additions and 11 deletions
|
|
@ -331,7 +331,8 @@ class Service(object):
|
|||
plan,
|
||||
do_build=True,
|
||||
timeout=DEFAULT_TIMEOUT,
|
||||
detached=False):
|
||||
detached=False,
|
||||
start=True):
|
||||
(action, containers) = plan
|
||||
should_attach_logs = not detached
|
||||
|
||||
|
|
@ -341,7 +342,8 @@ class Service(object):
|
|||
if should_attach_logs:
|
||||
container.attach_log_stream()
|
||||
|
||||
container.start()
|
||||
if start:
|
||||
container.start()
|
||||
|
||||
return [container]
|
||||
|
||||
|
|
@ -351,14 +353,16 @@ class Service(object):
|
|||
container,
|
||||
do_build=do_build,
|
||||
timeout=timeout,
|
||||
attach_logs=should_attach_logs
|
||||
attach_logs=should_attach_logs,
|
||||
start_new_container=start
|
||||
)
|
||||
for container in containers
|
||||
]
|
||||
|
||||
elif action == 'start':
|
||||
for container in containers:
|
||||
self.start_container_if_stopped(container, attach_logs=should_attach_logs)
|
||||
if start:
|
||||
for container in containers:
|
||||
self.start_container_if_stopped(container, attach_logs=should_attach_logs)
|
||||
|
||||
return containers
|
||||
|
||||
|
|
@ -376,7 +380,8 @@ class Service(object):
|
|||
container,
|
||||
do_build=False,
|
||||
timeout=DEFAULT_TIMEOUT,
|
||||
attach_logs=False):
|
||||
attach_logs=False,
|
||||
start_new_container=True):
|
||||
"""Recreate a container.
|
||||
|
||||
The original container is renamed to a temporary name so that data
|
||||
|
|
@ -395,7 +400,8 @@ class Service(object):
|
|||
)
|
||||
if attach_logs:
|
||||
new_container.attach_log_stream()
|
||||
new_container.start()
|
||||
if start_new_container:
|
||||
new_container.start()
|
||||
container.remove()
|
||||
return new_container
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue