Escaping characters for environment variables in dockerfiles

Hi all.

I try to run an image build from a dockerfile that contains the below environment variables:


the password has been altered but it follows the principals of the format. The build of the image went fine but when I run the image I get the below error:

2022-06-02 21:31:45 AUTH: Received control message: AUTH_FAILED
2022-06-02 21:31:45 SIGTERM[soft,auth-failure] received, process exiting

I suspect that its due to lack of escaping special characters in my assignment of the environment variables in the dockerfile.

My googleing have not helped me so far. Any assistance is highly appriciated :slight_smile:

I would suggest to quote the string, like you would quote it within a string in sh/bash.
Afterall an ENV is just an os environment variable in what the container is presented as it’s os.

You also might try, if makes a difference, if you use single quotes instead of double quotes. In sh/bash single quoted content is used literaly. I am not sure if realy makes a difference, but it might be still worth trying.

That may be the case, but you can find out for sure and use the approach to try strategies to fix it. When your build fails (presumably after the ENV declaration) you will see that you have an image created which includes everything up to the layer that failed. You can run and exec into that image and check what value your SURFSHARK_PASSWORD has in it, and take it from there.