Changing Root Directory
Next, the container needs to change its root directory to the merged
directory. This is done using the pivot_root
system call.
Because calling pivot_root
is a bit complicated, we provide a helper function: change_root
.
void change_root(const char* path);
This function will change the root directory to the specified path, as well as doing some other things to make the container work properly.