I have an environment variable defined in my windows settings as a user variable.
It is called GITLAB_AUTH_TOKEN.
In my Dockerfile I am trying to assign this variable to an environment variable called GAT like so:
ENV GAT=${GITLAB_AUTH_TOKEN}
This results in the GAT env var to be blank inside my container.
I have seen that it may be possible via docker-compose but that is not a solution for me, as my RUN command relies on this variable.
Related
I want to run apache spark history on a docker image, to achieve this I had to change spark-defaults.conf and add this line
spark.history.fs.logDirectory /path/to/remote/logs
And then run start-history-server.sh
This work fine when I set the value statically, however I want the value to be set from an environement variable that will be set on the docker container on run time, so I want something like this:
spark.history.fs.logDirectory ${env.path_to_logs}
However this doesn't work since the spark-defaults.conf deosn't access env variable, so is there a solution for this or maybe add a parameter when running start-history-server.sh ?
I am trying to pass on environment variables to be read from an XML file inside a docker container running wildly app service and hosted inside REHL 7 image.
What I've done so far:
I've created an environment file as key value pair, for example: FILESERVICE_MAX_POOL_SIZE=5
I am running docker by referencing the environment file: docker run -d --env-file ./ENV_VARIABLES <myImage>
In the Dockerfile I copy the xml template I need: COPY dockerfiles/standalone.xml /opt/wildfly/standalone/configuration/standalone.xml
Inside the XML template I'm trying to reference the environment variable: <max-pool-size>${env.FILESERVICE_MAX_POOL_SIZE}</max-pool-size>
I can see those environment variables inside the running container as root but not as the wildly user which needs them. How can I make an attribute visible to a specific user other than root ?
Clearly I'm doing something fundamentally wrong here just not sure what ?
Thanks in advance for your help.
Problem solved: wildfly couldn't see the attributes because in my startup script I didn't add the -E flag for sudo to preserve environment variables.
I tried to get the variable in docker-compose.yml like ${NODE_ENV} but doesn't work.
Also I don't want to send any param on my commands. I have defined already an environment variable on my system and I'd like to take that one from either one of these 2 files.
the solution was running export NODE_ENV=development again. I was losing this env var every time I was closing the terminal
When I hit the cmd set in csh it shows me a list of env variables I have right now in my session.
I was wondering where they are set/saved and couldn't find the location.
I have tried in files ~/.cshrc and ~/.cshrc.myusername and in both I saw none of the environment variables that set shows .
Where are they?
In memory. Each instance of csh will get a new copy of your default environment. Setting variables at the command prompt does not persist them anywhere for future sessions.
I want to assign a system variable within chef recipe
I am using the following code:
env 'DEF_ADDR' do
value "http://#{node['ipaddress']}"
end
However, I am getting the below error on executing the recipe
ERROR: Cannot find a resource for env on redhat version 6.6
The env resource seems to be only for Windows environments:
Use the env resource to manage environment keys in Microsoft Windows.
If you want to define an environment variable only for the Chef Run, you can use Ruby:
ENV['DEF_ADDR'] = "http://#{node['ipaddress']}"
But this will only be accessible during the Chef Run.
If you want to define a system-wide environment variable, maybe the etc_environment cookbook could help you with that:
node.default['etc_environment']['DEF_ADDR'] = "http://#{node['ipaddress']}"
There is no consistent way to set global environment variables on Unix. Some distros support global-level shell includes via things like /etc/profile.d and the like, but this will have no effect on things run outside of a shell like direct SSH execution or running as a service.