boost::filesystem::exists throws operation not permitted exception on CentOS 8 docker with boost v1.75

Viewed 652

I use boost 1.75, and on a particular CentOS-8 docker container runs on Ubuntu-18 I get an exception with boost::filesystem::exists() even with a valid path. But if I use the same docker runs on local Mac or Ubuntu-18 there's no issue.

Here is the exception: C++ exception with description "boost::filesystem::status: Operation not permitted: "../path/

filesystem::path path = filesystem::current_path();
boost::filesystem::exists(path); // throws the same exception
file_status s = boost::filesystem::status(path); // throws the same exception

I'm not sure something missed with building the boost static libraries. For the same OS the boost 1.64 has no issue with the above code.

OS : CentOS-8

Compiler : gcc 8.3.1

boost : 1.75, compiled on local CentOS-8 docker with gcc-8.3.1.

1 Answers

Had this problem at work. Running docker run --privileged "solved" the issue. We ended up replacing boost::filesystem::exists() with std::filesystem::exists() which solved the issue without the --privileged flag (gcc10 though).

Related