|
|
|
@ -490,14 +490,16 @@ fn delete_container(containers_id: &str) -> Result<()> {
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<()>{
|
|
|
|
|
let args = RockerArgs::parse();
|
|
|
|
|
// run
|
|
|
|
|
if let (Some(cmd), Some(image_name)) = (&args.run, &args.image) {
|
|
|
|
|
// run
|
|
|
|
|
let volume_path = extend_image(image_name)?;
|
|
|
|
|
let (container_id, pid) = run_container(cmd, &args, &volume_path)?;
|
|
|
|
|
save_container_info(&args, &container_id, pid)?; // todo 无论出不错, 都要保存一个信息, 后面需要删除用清理
|
|
|
|
|
} else if args.ps || args.psa {
|
|
|
|
|
// --ps
|
|
|
|
|
show_containers(args.psa)?
|
|
|
|
|
} else if let Some(containers_id) = &args.rm {
|
|
|
|
|
// --rm
|
|
|
|
|
delete_container(containers_id)?;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -505,8 +507,6 @@ fn main() -> Result<()>{
|
|
|
|
|
|
|
|
|
|
// logs
|
|
|
|
|
|
|
|
|
|
// rm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|