Docker Community Forums

Share and learn in the Docker community.

C code for multi-threaded HTTP Server segfaulting when running in Docker container Ubuntu 18.04

I wrote a multi-threaded HTTP server in C as part of an academic project, and I would like to containerize it and post it to my portfolio page. As per the spec of the project, we developed this server in an Ubuntu 18.04 environment on virtual machines. The server has a “healthcheck” functionality in which it returns the ratio of successfully serviced requests to unsuccessfully serviced requests. For some reason, when I containerize the server in an Ubuntu 18.04 container running gcc 7.5.0, it segfaults when a client requests a healthcheck. My code does NOT do this, however, when it’s running in a virtual machine with the exact same environment (Ubuntu 18.04, gcc 7.5.0). Before I go back into the hell that is trying to debug multi-threaded C code, does anyone possibly have any insight as to why this might be happening? Could it be an issue with Docker’s Ubuntu 18.04 image and not my code? Seems like this might be the case since the problem doesn’t occur in the VM?
Thank you so much for any help, your time and input is greatly appreciated!