Dockerfile ARG names can not be blank

46 Views Asked by At

I have a Dockerfile that needs to download a sso cert and store in a directory. Im able to pull the metadata and store it in a json file but I need to be able to parse out the json in my Dockerfile to get the X509Certificate cert string. Here is the code that I currently have but when trying to store the json into a ARG it throws an error saying ARG names can not be blank. How do I store the json as a variable in a Dockerfile so I can parse out the X509Certificate cert string?

WORKDIR /app
RUN apt-get update && apt-get install -y curl
RUN curl -s https://myssolink/metadata > /tmp/response.json
ARG JSON_RESPONSE=$(cat /tmp/response.json)
1

There are 1 best solutions below

0
SikZone On

Docker does not support this. Your best bet would be to handle this within a RUN command, for example:

RUN specific_line=$(sed 'Xq;d' /tmp/response.json) && echo $specific_line