Skip to content

Instantly share code, notes, and snippets.

@mapk0y
Created June 22, 2015 19:34
Show Gist options
  • Save mapk0y/43a49b644455e87a2173 to your computer and use it in GitHub Desktop.
Save mapk0y/43a49b644455e87a2173 to your computer and use it in GitHub Desktop.
runC の挙動に関して

ディレクトリ構成

host:~/runcdir# ls -la
total 16
drwxr-xr-x  3 root root 4096  6月 23 04:22 .
drwx------ 17 root root 4096  6月 23 04:29 ..
-rw-r--r--  1 root root 2082  6月 23 03:35 container.json
drwxr-xr-x 21 root root 4096  6月 23 04:24 rootfs

現象

ダメなとき

host:~/runcdir# ../runc
Timestamp: 2015-06-23 04:22:47.005279311 +0900 JST
Code: System error

Message: fork/exec ../runc: no such file or directory

良い時

host:~/runcdir# /root/runc
$ 
host:~/runcdir# ~/runc
$ 

/usr/local/sbin/runc にいれて PATH 通した場合も大丈夫だったはず

理由

プログラムの中で rootfs に chdir して runc を exec してるから

3602  04:26:46.364413 chdir("/root/runcdir/rootfs" <unfinished ...>
3602  04:26:46.364781 execve("../runc", ["../runc", "init"], [/* 2 vars */] <unfinished ...>

runc を対象の場所に用意してあげれば動く

host:~/runcdir# ln -snvf ../runc
‘./runc’ -> ‘../runc’
host:~/runcdir# ls -l
total 8
-rw-r--r--  1 root root 2082  6月 23 03:35 container.json
drwxr-xr-x 21 root root 4096  6月 23 04:32 rootfs
lrwxrwxrwx  1 root root    7  6月 23 04:32 runc -> ../runc
host:~/runcdir# ../runc
$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment