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

Commit

Permalink
Add support for autostart of Docker containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmistrz committed Jul 12, 2019
1 parent 15978f6 commit 40ddf41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gu-model/src/dockerman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub struct CreateOptions {
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub net: Option<NetDef>,
#[serde(default)] // default is false
pub autostart: bool,
}

impl CreateOptions {
Expand Down
5 changes: 4 additions & 1 deletion gu-provider/src/dockerman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,14 @@ impl Handler<CreateSession<CreateOptions>> for DockerMan {
ActorResponse::r#async(fut::wrap_future(pull_and_create).and_then(
move |id, act: &mut DockerMan, _| {
if let Some(ref api) = act.docker_api {
let deploy = DockerSession {
let mut deploy = DockerSession {
workspace,
container: api.container(Cow::from(id.clone())),
status: PeerSessionStatus::CREATED,
};
if msg.options.autostart {
deploy.do_start();
}
act.deploys.insert_deploy(id.clone(), deploy);
fut::ok(id)
} else {
Expand Down

0 comments on commit 40ddf41

Please sign in to comment.