Operation chmod 0777 not permitted inside a running Docker container

I am trying to execute some unit testing for my C++ code inside a Docker container that calls the command:

if (chmod("/tmp/ipc_unixdomain", 0777) != 0) {

In my PC outside of the container, I am able to run this command in both the terminal and the C++ code, but once I move inside the container I am only able to execute them if I run as the root user or with sudo. If I don’t do it like that I get the error message

Operation not permitted

I would like to have a way to normally execute my tests without the need for sudo privileges. Is there a way to solve this by modifying the Dockerfle or changing my code?

Source: Docker Questions