Skip to content
Ye Wang edited this page Aug 18, 2016 · 1 revision

Quote this to prevent word splitting

Problematic code:

FROM debian:jessie
MAINTAINER Ye Wang <ye@users.noreply.github.com>

RUN echo index-url = http://$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}'):3141/root/pypi/ >> /root/.pip/pip.conf

Correct code:

FROM debian:jessie
MAINTAINER Ye Wang <ye@users.noreply.github.com>

RUN echo "index-url = http://$(netstat -nr | grep '^0\.0\.0\.0' | awk '{print $2}'):3141/root/pypi/" >> /root/.pip/pip.conf

Rationale:

Quote the echo output which has another command's output that may contain white spaces to cause word splitting.

Clone this wiki locally