meWantToLearn
meWantToLearn

Reputation: 1700

docker sed arg variable not being used

I have a simple dockerfile which uses sed to replace variable in a file. The variable is being set from Dockerfile arg. However, it doesn't get used.

FROM php:7.4-cli
ARG VERSION=3.2
RUN sed -in '/<\/body>/i <version="${VERSION}">' /var/www/readme.xml

the output is:
<version="${VERSION}">

expected output needs to be:

<version="3.2">

Upvotes: 1

Views: 203

Answers (1)

Ed Morton
Ed Morton

Reputation: 204456

Change your quotes to be "/<\/body>/i <version=\"${VERSION}\">". See https://mywiki.wooledge.org/Quotes.

Upvotes: 1

Related Questions