Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.1章节执行后没有把/root/busybox映射到/ #90

Open
yvanu opened this issue Nov 7, 2022 · 2 comments
Open

4.1章节执行后没有把/root/busybox映射到/ #90

yvanu opened this issue Nov 7, 2022 · 2 comments

Comments

@yvanu
Copy link

yvanu commented Nov 7, 2022

image

有大佬遇到这个问题吗?
@wss404
Copy link

wss404 commented Mar 14, 2023

@Xavier-wa
Copy link

Xavier-wa commented Apr 28, 2024

我把container_process中容器文件系统的目录cmd.Dir = /root/busybox ,改到宿主机用户目录下面工作空间的目录就好了,没有放在/root/下

// 配置Namespace 创建父进程
func NewParentProcess(tty bool) (*exec.Cmd, *os.File) {
readPipe, writePipe, err := NewPipe()
if err != nil {
log.Errorf("New pipe error %v", err)
return nil, nil
}
///proc 下是所有进程
cmd := exec.Command("/proc/self/exe", "init")
cmd.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUTS | syscall.CLONE_NEWPID | syscall.CLONE_NEWNS |
syscall.CLONE_NEWNET | syscall.CLONE_NEWIPC,
}
if tty {
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
}
cmd.ExtraFiles = []*os.File{readPipe}
cmd.Dir = "/home/xxx/Workspace/Golangws/xxxDocker/busybox"
return cmd, writePipe
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants