|
|
|
@ -234,7 +234,7 @@ fn get_env_vec(env: &String) -> Result<Vec<String>> {
|
|
|
|
Ok(env_vec)
|
|
|
|
Ok(env_vec)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn init_container_env(env_vec: Vec<String>) -> Result<()>{
|
|
|
|
fn init_container_env(env_vec: &Vec<String>) -> Result<()>{
|
|
|
|
for item_env in env_vec.iter() {
|
|
|
|
for item_env in env_vec.iter() {
|
|
|
|
let item_env_v = item_env.split("=").collect::<Vec<&str>>();
|
|
|
|
let item_env_v = item_env.split("=").collect::<Vec<&str>>();
|
|
|
|
if item_env_v.len() == 2 {
|
|
|
|
if item_env_v.len() == 2 {
|
|
|
|
@ -432,6 +432,9 @@ fn run_container(container_info: &ContainerInfo, is_exec_cmd: Option<&String>) -
|
|
|
|
let rocker_uid = rocker_user_info.uid;
|
|
|
|
let rocker_uid = rocker_user_info.uid;
|
|
|
|
let rocker_gid = rocker_user_info.gid;
|
|
|
|
let rocker_gid = rocker_user_info.gid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let env_vec = get_env_vec(&container_info.env)?;
|
|
|
|
|
|
|
|
let volume_path = extend_image(&container_info.image)?;
|
|
|
|
|
|
|
|
|
|
|
|
let _cb = if let Some(exec_cmd) = is_exec_cmd {
|
|
|
|
let _cb = if let Some(exec_cmd) = is_exec_cmd {
|
|
|
|
let _cb = || {
|
|
|
|
let _cb = || {
|
|
|
|
init_exec_ns(container_info.procs[0]).unwrap();
|
|
|
|
init_exec_ns(container_info.procs[0]).unwrap();
|
|
|
|
@ -441,7 +444,7 @@ fn run_container(container_info: &ContainerInfo, is_exec_cmd: Option<&String>) -
|
|
|
|
init_container_user(rocker_uid, rocker_gid).unwrap();
|
|
|
|
init_container_user(rocker_uid, rocker_gid).unwrap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
init_container_env(env_vec).unwrap();
|
|
|
|
init_container_env(&env_vec).unwrap();
|
|
|
|
create_pause(container_root_pause_path).unwrap();
|
|
|
|
create_pause(container_root_pause_path).unwrap();
|
|
|
|
while container_merged_pause_path.exists() {
|
|
|
|
while container_merged_pause_path.exists() {
|
|
|
|
std::thread::sleep(std::time::Duration::from_millis(10));
|
|
|
|
std::thread::sleep(std::time::Duration::from_millis(10));
|
|
|
|
@ -460,9 +463,6 @@ fn run_container(container_info: &ContainerInfo, is_exec_cmd: Option<&String>) -
|
|
|
|
let _cb = || {
|
|
|
|
let _cb = || {
|
|
|
|
sethostname(USER_NAME).unwrap();
|
|
|
|
sethostname(USER_NAME).unwrap();
|
|
|
|
clear_env();
|
|
|
|
clear_env();
|
|
|
|
let env_vec = get_env_vec(&container_info.env).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let volume_path = extend_image(&container_info.image).unwrap();
|
|
|
|
|
|
|
|
init_container_overlay(&volume_path, &container_upper_path, &container_merged_path).unwrap();
|
|
|
|
init_container_overlay(&volume_path, &container_upper_path, &container_merged_path).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
// 用户自定义的文件映射
|
|
|
|
// 用户自定义的文件映射
|
|
|
|
@ -482,7 +482,7 @@ fn run_container(container_info: &ContainerInfo, is_exec_cmd: Option<&String>) -
|
|
|
|
init_container_proc().unwrap();
|
|
|
|
init_container_proc().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
// 设置自定义env
|
|
|
|
// 设置自定义env
|
|
|
|
init_container_env(env_vec).unwrap();
|
|
|
|
init_container_env(&env_vec).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// init_container_pts().unwrap();
|
|
|
|
// init_container_pts().unwrap();
|
|
|
|
|