2

I have a docker image which has a c++ executable with dependencies packed into it. This executable runs fine outside docker environment and i have tested it multiple times. However inside docker it stops immediately as and when started.

To debug i have added a std::cout << "Main 1" << std::endl as soon as main() function is called. But even this is not being printed when i start the executable inside docker.

Any tips on how to debug this issue.

Adding docker file which is used to build the docker image.

FROM ubuntu:18.04

# install app dependencies
RUN apt-get -yqq update \
        && apt-get -yqq dist-upgrade \
        && apt-get -yqq install apt-utils libgomp1 libprotobuf10 libboost-thread1.65.1 libboost-filesystem1.65.1 libopencv-core3.2 libopencv-imgproc3.2 libopencv-imgcodecs3.2 libjpeg-turbo8 libpo
        && apt-get -yqq remove systemd cups perl ffmpeg apt-utils \
        && rm -rf /var/lib/apt/lists/*

# create app folder
RUN mkdir -p /opt/aimes

# copy app, dependencies and config
COPY deps/aimes /opt/aimes/
COPY deps/*.* /opt/aimes/
COPY deps/config /opt/aimes/config

# copy wrapper script
COPY run-es.sh /opt/aimes/

# run command
WORKDIR /opt/aimes
ENV LD_LIBRARY_PATH .
ENTRYPOINT ["./run-es.sh"]

1 Answers1

0

Adding --cap-add=SYS_PTRACE to docker run command helped in finding out issue using gdb.

Also the solution was to add the above option to docker run command, since the exe required root permissions.

Below command solved my issue.

docker run --cap-add=SYS_PTRACE -it --rm