Docker Community Forums

Share and learn in the Docker community.

Sed: no input files

Hi,

I’m trying to build certain images in these lines of code:

RUN cd /Image-Comparator/
RUN grep -rl DB1 /Image-Comparator/* | xargs sed -i ‘s/ret_images/DB1/g’
RUN grep -rl 172.29.112.1 /Image-Comparator/* | xargs sed -i ‘s/ec2-18-220-36-255.us-east-2.compute.amazonaws.com/172.29.112.1/g’
RUN grep -rl “5984” /Image-Comparator/* | xargs sed -i ‘s/5984/<database_port>/g’

However, I tried running the following command:
docker build . -t db1:172.29.112.1

But I got this error message:
Step 17/19 : RUN grep -rl 172.29.112.1 /Image-Comparator/* | xargs sed -i ‘s/ec2-18-220-36-255.us-east-2.compute.amazonaws.com/172.29.112.1/g’
—> Running in 7a0bc01ea9cf
sed: no input files
The command ‘/bin/sh -c grep -rl 172.29.112.1 /Image-Comparator/* | xargs sed -i ‘s/ec2-18-220-36-255.us-east-2.compute.amazonaws.com/172.29.112.1/g’’ returned a non-zero code: 123

Any help is much appreciated. Thanks.

I would suggest, writing these as a script. Then do a COPY of script into container, then do a RUN on the script.
Then add some good logging of the data that is returned before the sed command…