<p>I have this dockerfile</p>
<pre><code>FROM rabbitmq:3.7.12-management
CMD . /files/envinfo &amp;&amp; echo $RABBITMQ_DEFAULT_USER &amp;&amp; rabbitmq-server
</code></pre>
<p>In the envinfo I have this content</p>
<p>export RABBITMQ_DEFAULT_USER='anothername'</p>
<p>When the docker starts up the echo of RABBITMQ_DEFAULT_USER really prints out anothername. But when the service starts it doesnt see it.</p>
<p>If I set the environment variable another way from the kubernetes file it works as it should.</p>
<p>You can see the rabbitmq image I extend here.
<a href="https://github.com/docker-library/rabbitmq/blob/35b41e318d9d9272126f681be74bcbfd9712d71b/3.8/ubuntu/Dockerfile" rel="nofollow noreferrer">https://github.com/docker-library/rabbitmq/blob/35b41e318d9d9272126f681be74bcbfd9712d71b/3.8/ubuntu/Dockerfile</a></p>
<p>I have another process that fetches the file and puts it in /files/envinfo to make it available for this docker image when it starts. So I cant use environment settings from  kubernetes.</p>
<p>Looking forward to hear some suggestions =)</p>

Ole Bille
<p>I agree with @code-gorilla use Kubernetes environment variables. But another way to do it is to source the environment variables before the entry point:</p>
<pre><code>ENTRYPOINT [&quot;source /files/envinfo &amp;&amp; docker-entrypoint.sh&quot;]
</code></pre>
<p>Overriding <code>CMD</code> will only change the argument to <code>ENTRYPOINT</code>, that's probably why it doesn't work for you.</p>
