"RUN sed" fails in Dockerfile

2,280 views
Skip to first unread message

Lantos István

unread,
Jun 24, 2015, 3:39:53 PM6/24/15
to coreo...@googlegroups.com
It is debian:latest with my modification. My problem is $ sed command always fails. I think my regex code getting nesty with Dockerfile. It runs fine inside a container.

As you can see on my uncomments, I need to use /bin/bash -c method, because the default RUN (/bin/sh) always fails.

Here is the console log part:

Step 4 : RUN ["/bin/bash", "-c", "sed -i '/^deb http\:\/\/httpredir\.debian\.org\/debian jessie\smain$\|^deb http\:\/\/httpredir\.debian\.org\/debian jessie\-updates\smain$\|^deb http\:\/\/security\.debian\.org jessie\/updates main$/d' /etc/apt/sources.list"]
 ---> Running in 33a7267fdaeb
/bin/sh: 1: [/bin/bash,: not found
Removing intermediate container 33a7267fdaeb
INFO[0002] The command [/bin/sh -c ["/bin/bash", "-c", "sed -i '/^deb http\:\/\/httpredir\.debian\.org\/debian jessie\smain$\|^deb http\:\/\/httpredir\.debian\.org\/debian jessie\-updates\smain$\|^deb http\:\/\/security\.debian\.org jessie\/updates main$/d' /etc/apt/sources.list"]] returned a non-zero code: 127

Thank You for your help!

Lantos István

unread,
Jul 1, 2015, 4:18:56 PM7/1/15
to coreo...@googlegroups.com
Adding thid to the Dockerfile's head solved the issue:

    RUN rm /bin/sh && ln -s /bin/bash /bin/sh && rm /bin/sh.distrib && ln -s /bin/bash /bin/sh.distrib
Reply all
Reply to author
Forward
0 new messages