Skip to content
Ye Wang edited this page Aug 17, 2016 · 2 revisions

Double quote to prevent globbing and word splitting.

Problematic code:

FROM gcr.io/google_appengine/base

WORKDIR /opt
ENV GCLOUD_VERSION=118.0.0
RUN wget -qO- https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz | tar xzf -

Correct code:

FROM gcr.io/google_appengine/base

WORKDIR /opt
ENV GCLOUD_VERSION=118.0.0
RUN wget -qO- "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz" | tar xzf -

Rationale:

Double quote the download link with variable(s) that contains spaces.

Clone this wiki locally