Docker Community Forums

Share and learn in the Docker community.

Problem with updating Git Submodules in Docker container

build

(Dragonosman) #1

I’m creating a new thread for this since I thought it might need it.

Just a bit ago, when trying to build my Dockerfile project, I ran into this problem:

Step 16/24 : RUN git clone https://github.com/flexferrum/jinja2cpp && cd jinja2cpp && git pull && git submodule -q update --init && mkdir build && cd build && cmake … -DCMAKE_INSTALL_PREFIX=…/install -DCMAKE_PREFIX_PATH:PATH=/usr/local/include -DBOOST_ROOT=/usr/local/include && cmake --build . --target all --config Release && cmake --build . --target install --config Release
—> Running in 3d2a0b4f2e48
Cloning into ‘jinja2cpp’…
remote: Enumerating objects: 77, done.
remote: Counting objects: 100% (77/77), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 1364 (delta 31), reused 30 (delta 14), pack-reused 1287
Receiving objects: 100% (1364/1364), 400.08 KiB | 150.00 KiB/s, done.
Resolving deltas: 100% (937/937), done.
Already up to date.
/usr/lib/git-core/git-submodule: 7: /usr/lib/git-core/git-submodule: sed: not found
/usr/lib/git-core/git-submodule: 86: /usr/lib/git-core/git-sh-setup: sed: not found
/usr/lib/git-core/git-submodule: 332: /usr/lib/git-core/git-sh-setup: uname: not found
/bin/sh: 1: mkdir: not found
The command ‘/bin/sh -c git clone https://github.com/flexferrum/jinja2cpp && cd jinja2cpp && git pull && git submodule -q update --init && mkdir build && cd build && cmake … -DCMAKE_INSTALL_PREFIX=…/install -DCMAKE_PREFIX_PATH:PATH=/usr/local/include -DBOOST_ROOT=/usr/local/include && cmake --build . --target all --config Release && cmake --build . --target install --config Release’ returned a non-zero code: 127

Dockerfile:

FROM dragonosman/ubuntu:latest-sudo
RUN adduser --disabled-password --gecos ‘’ osman
RUN adduser osman sudo
RUN echo ‘%sudo ALL=(ALL) NOPASSWD:ALL’ >> /etc/sudoers
USER osman
WORKDIR /home/osman/
COPY scripts ./scripts
COPY styles ./styles
COPY currency_converter.cpp /home/osman/
COPY index.html /home/osman/
RUN ls
RUN sudo apt-get update -y
&& sudo apt-get install -y git
g++
build-essential
make
wget
RUN sudo mkdir /usr/local/cmake
&& sudo wget -O cmake-linux.sh https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh
&& sudo sh cmake-linux.sh – --skip-license --prefix=/usr/local/cmake
ENV PATH="/usr/local/cmake/bin:{PATH}"13 RUN sudo wget https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2 \ && sudo tar -xjf boost_1_68_0.tar.bz2 \ && sudo rm -rf boost_1_68_0.tar.bz2 \ && cd boost_1_68_0 \ && sudo ./bootstrap.sh --prefix=/usr/local \ && sudo ./b2 link=shared install RUN git clone https://github.com/flexferrum/jinja2cpp \ && cd jinja2cpp \ && git pull \ && git submodule -q update --init \ && mkdir build \ && cd build \ && cmake .. -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH:PATH=/usr/local/include -DBOOST_ROOT=/usr/local/include \ && cmake --build . --target all --config Release\ && cmake --build . --target install --config Release RUN git clone https://github.com/nlohmann/json RUN g++ -std=c++17 -Wall -pedantic -D variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -I ./jinja2cpp/install/include -I ./json/single_include -I /usr/local/include/ currency_converter.cpp -L ./jinja2cpp/install/lib/static -ljinja2cpp -L usr/local/lib/ -lboost_system -lpthread -o currency_converter EXPOSE 8080 ENV apikey="<apikey>:{apikey}"
ENV accesskey=":${accesskey}"
RUN echo -e “\n/usr/local/lib” | sudo tee -a /etc/ld.so.conf
&& sudo ldconfig
RUN chmod -r–r--r-- styles.css scripts.js index.html
&& chmod a+x currency_converter
CMD ["./currency_converter", “0.0.0.0”, “8080”, “.”]

Anyone have any idea how to fix this?

I’m using Docker Toolbox version 18.03.0-ce, build 0520e24302. OS is Windows 10 Home Single Language, version 1803 build 17134.345. My code is on GitHub here. The one inside the directory with the Dockerfile has a difference compared to the one on GitHub, but it’s mostly the same. The difference is: in the scripts.js file, the POST action value for the form is https://dragonscurrencyconv.herokuapp.com (because I want to deploy the Docker image to Heroku at that address – address won’t work at the moment, though, since the app hasn’t been deployed to Heroku yet).

[Why did the “EXPOSE 8080” and “ENV” parts get mixed into the compilation command? I don’t have it like that in the Dockerfile.]

Edit: Okay, I think I figured it out. I was counting the number of steps in the Dockerfile earlier by typing in numbers, but I forgot to take out the “13” at the end of the ENV command for adding CMake to the PATH. I wasn’t able to get it to change the file permissions on those files either, but I should be able to that when building the container as root user and then running it as a normal user (should work for this app).