I have a simple Dockerfile that downloads the node.js source tarball, checksums it, extracts it, builds and installs it. The checksum works when manually run in an interactive docker container, but fails when running the exact same commands when building a Dockerfile.
Works:
docker run -i -t ubuntu:12.04 /bin/bash
cd /tmp
apt-get update -y
apt-get install wget build-essential automake -y
wget http://nodejs.org/dist/latest/node-v0.10.26.tar.gz
wget http://nodejs.org/dist/latest/SHASUMS256.txt
sha256sum -c SHASUM256.txt 2>&1|grep -qs OK
tar -xvf node-v0.10.26.tar.gz && cd node-v0.10.26
./configure && make && make install
Doesn't work:
sudo docker build -t="my_docker_node_image_01" .
Error is:
sudo docker build -t="my_docker_node_image_01" .
Uploading context 7.168 kB
Uploading context
Step 0 : FROM ubuntu:12.04
---> 9cd978db300e
Step 1 : RUN cd /tmp
---> Using cache
---> 0467ad75bbd6
Step 2 : RUN apt-get update -y
---> Using cache
---> d2933f250090
Step 3 : RUN apt-get install wget build-essential automake -y
---> Using cache
---> e8a71b28782a
Step 4 : RUN wget http://nodejs.org/dist/latest/node-v0.10.26.tar.gz
---> Using cache
---> bae7de7b46f7
Step 5 : RUN wget http://nodejs.org/dist/latest/SHASUMS256.txt
---> Using cache
---> 245f6b6ceb84
---> 77532c879864
Step 6 : RUN sha256sum -c SHASUM256.txt 2>&1|grep -qs OK
---> Running in 77765e80f55b
2014/04/22 22:27:32 The command [/bin/sh -c sha256sum -c SHASUM256.txt 2>&1|grep -qs OK] returned a non-zero code: 1
I tried adding less SHASUMS256.txt to the Dockerfile just to confirm that file is successfully downloaded uncorrupted, and it is, but still getting the error anyway.
I'm not sure how to troubleshoot this since normally I would just manually run all the steps in an interactive container to see what goes wrong. Any suggestions much appreciated.
sha256summight write to the console, but should set the proper exit code if the file is OK. Also, can you echo the sum from SHASUM256.txt and the calculated sum from node.gz? I couldn't get this to fail. - Todd