Debugging a docker container

submited by
Style Pass
2021-06-10 17:30:04

In the evening I tried to Dockerize the Perl version of tumblelog. This went very well until I tried to add the CommonMark Perl module which relies on a C library: libcmark.

Since I used a multi-stage build and cpanm was able to build and test the module something went wrong in the second stage (run). It took me some time to understand that could not be found, despite the clear message, and that COPY --from=builder /usr/local /usr/local did work as expected.

But where was this required file located? After some reading up on staged builds I learned that I could stop the building process at a certain stage. So I stopped at the builder stage as follows:

This one-liner tries to load the CommonMark module and executes the program 1. Executing the above resulted in no error at all. So far so good. Next I used find to locate To be cautious I searched for each file starting with libcmark* as follows:

Note that this file is not complete. If you want to Dockerize using the above you have to add Try::Tiny to the list of Perl modules.

Leave a Comment