I am new to Docker. I am creating a Dockerfile to build my C/C++ application using a custom Makefile. The Makefile builds my code correctly outside Docker and all is good. However, there is an issue when using Docker. My Dockerfile looks as follows :
FROM gcc:latest
RUN apt-get update
RUN apt-get install libboost1.62-*
RUN apt-get install -y libmodbus-dev
COPY . /usr/src/client
WORKDIR /usr/src/client
RUN make -f MyMakefile.mak
CMD [ "bin/runfile" ]
Obviously my code needs libboost
and libmodbus
and therefore install them first. This was actually all working fine last week, but not now somehow. There is an issue finding the header files for the boost library afterwards though during compilation :
Sending build context to Docker daemon 255MB
Step 1/8 : FROM gcc:latest
---> 9bfd59c68035
Step 2/8 : RUN apt-get update
---> Using cache
---> 0ee029cb9883
Step 3/8 : RUN apt-get install libboost1.62-*
---> Using cache
---> 4d76aa8ea9a1
Step 4/8 : RUN apt-get install -y libmodbus-dev
---> Using cache
---> 35f300d99fa4
Step 5/8 : COPY . /usr/src/client
---> 5b880a0488d4
Step 6/8 : WORKDIR /usr/src/client
---> Running in 13c8a522b792
Removing intermediate container 13c8a522b792
---> 2c5d62aa1b32
Step 7/8 : RUN make -f MyMakefile.mak
---> Running in 7e8b5138bb55
g++ -Iinc -Iinc/common -Iinc/modbus -MMD -MP -std=c++11 -c src/main.cpp -o obj/main.o
In file included from inc/clientdevice_ctrl.h:23,
from inc/client_ctrl.h:21,
from src/main.cpp:23:
inc/profile.h:15:10: fatal error: boost/property_tree/json_parser.hpp: No such file or directory
15 | #include <boost/property_tree/json_parser.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [MyMakefile.mak:29: obj/main.o] Error 1
The command '/bin/sh -c make -f MyMakefile.mak' returned a non-zero code: 2
Where would Docker attempt to find these required header files? I would think that in the standard header locations?