Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker build does not proceed after finishing RUN statement

I am trying to build a docker container (my first one ever) to set up a cross compiling environment for an embedded device.

I included a RUN statement that executes a script which installs the SDK provided by the manufacturer of the embedded device. I verified, that the script finishes successfully with exit code 0 when ran manually in the running docker container.

However, during a docker build, the very same script prints its finishing message and then nothing happens anymore. The following RUN statements are not executed at all and the build does not finish. I have to abort the build process to get back to my shell. Can anyone imagine why this specific run statement does not finish properly, even when the executed script exits successfully?

The dockerfile in question:

# origin of the image from the official docker hub
FROM ubuntu:trusty

# adding the SDK into the image
ADD tgur-access-sdk-v0.9.0.tar.gz /opt/

# installing necessary dependencies
RUN apt-get update && apt-get install -y \
    g++ \
    gcc \
    make \
    python2.7

# create symlink for python to ensure that the sdk install script succeeds
RUN ln -s /usr/bin/python2.7 /usr/bin/python

# Install the SDK automagically and delete the file afterwards
RUN /opt/gad-eglibc-x86_64-tgur-access-image-base-cortexa9hf-vfp-neon-toolchain-1.0.0.sh -y -d /opt/gad/R9.0/
RUN rm /opt/gad-eglibc-x86_64-tgur-access-image-base-cortexa9hf-vfp-neon-toolchain-1.0.0.sh

# Notify the user about the success
RUN echo "Enjoy your new Docker container"

The corresponding output with me aborting the hanging build after several minutes:

Sending build context to Docker daemon  379.8MB
Step 1/7 : FROM ubuntu:trusty
 ---> 02a63d8b2bfa
Step 2/7 : ADD tgur-access-sdk-v0.9.0.tar.gz /opt/
 ---> Using cache
 ---> 9b6d032ec91e
Step 3/7 : RUN apt-get update && apt-get install -y     g++     gcc     make    python2.7
 ---> Running in 09bdccf10430

[..lots of apt-get msgs..]

Removing intermediate container 09bdccf10430
 ---> 12873d3e50ae
Step 4/7 : RUN ln -s /usr/bin/python2.7 /usr/bin/python
 ---> Running in c1b8256e1fd0
Removing intermediate container c1b8256e1fd0
 ---> 166d5473a18f
Step 5/7 : RUN /opt/gad-eglibc-x86_64-tgur-access-image-base-cortexa9hf-vfp-neon-toolchain-1.0.0.sh -y -d /opt/gad/R9.0/
 ---> Running in aff8a5f102f8
Enter target directory for SDK (default: /opt/gad/1.0.0): /opt/gad/R9.0/
You are about to install the SDK to "/opt/gad/R9.0". Proceed[Y/n]?Y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.
^C
like image 340
darkmattercoder Avatar asked Nov 27 '22 01:11

darkmattercoder


2 Answers

I got the issue solved by adding a WORKDIR statement to the dockerfile that sets the working directory to /opt/. After that, the RUN statement finishes. There must be something inside of the install script that messes things up when invoked with an absolute path from inside the docker build environment (even when it works when invoked from a shell in the docker container). The final dockerfile now contains:

# Install the SDK automagically and delete the file afterwards

WORKDIR /opt
RUN ./gad-eglibc-x86_64-tgur-access-image-base-cortexa9hf-vfp-neon-toolchain-1.0.0.sh -D -y -d /opt/gad/R9.0
RUN rm gad-eglibc-x86_64-tgur-access-image-base-cortexa9hf-vfp-neon-toolchain-1.0.0.sh
like image 143
darkmattercoder Avatar answered Dec 04 '22 03:12

darkmattercoder


I just ran into this same problem myself. Trying to install a Yocto SDK in a docker image. The script appears to be stuck after it completes. It turns out you need to be patient. I let an installation run sit while I ran an errand and I came back to a successfully installed SDK. Unfortunately, running with -D to enable debugging did not reveal why the installation takes as long as it does.

like image 35
A. Penner Avatar answered Dec 04 '22 03:12

A. Penner