During
“docker build process”, is possible to assign environment variable via a script?
Otherwise, is the “sed” commend limit in “this script”?
/home/my_variable has content, “helloworld” only.
RUN echo "#!/bin/sh\nMYVARIABLE=$(cat /home/my_variable)\nsed -i "s/MYVARIABLE/${MYVARIABLE}/g" /my_target_path/target.txt\n > /home/my_script.sh
This script content definitely has the right content and I also generate the output to check it.
Step 2/5: RUN cat /home/my_script.sh
—> Running in x3f3ds9ef37d
#!/bin/sh
MYVARIABLE=helloworld
sed -i “s/MYVARIABLE/${MYVARIABLE}/g” /my_target_path/target.txt
But, I get a wrong with this message. I want to know the reason. Thanks.
sed: -e expression #1, char 26: unknown option to `s’