Linked Questions
12 questions linked to/from Dockerfile - set ENV to result of command
0 votes
1 answer
2k views
Run shell command while setting ENV in dockerfile [duplicate]
Inside my dockerfile: ENV MY_ENCODED_VALUE="bXkgbmFtZSBpcyByYWtpYgo=" ENV MY_DECODED_VALUE=$(echo $MY_ENCODED_VALUE | base64 -d) in the second line, i want to decode the encoded value and put the ...
1 vote
0 answers
71 views
Dockerfile set ENV based on npm package version [duplicate]
I have a line in a dockerfile to set the container's environment variable based on the output of an npm script: ENV BUILD_VERSION=$(npm pkg get version | sed 's/"//g') running npm pkg get ...
0 votes
0 answers
25 views
Env variable not getting echoed in Dockerfile [duplicate]
This is my Dockerfile: FROM node:16.15.1-buster RUN npm pkg get version RUN VERSION=$(npm pkg get version) RUN echo "$VERSION" I am using this to build the image: docker build --progress ...
17 votes
4 answers
65k views
how to solve Docker issue Failed to connect to bus: No such file or directory [closed]
Trying to run following command in the ubuntu 16.04 docker container root@mytest:/Linux_Insight_Agent# systemctl start ir_agent.service I have installed neede packages but at the time of starting the ...
9 votes
4 answers
13k views
Parse a variable with the result of a command in DockerFile
I need to fill a variable in dockerfile with the result of a command Like in bash var=$(date) EDIT 1 date is a example. in my case i use FROM phusion/baseimage:0.9.17 so i want at each building use ...
1 vote
4 answers
8k views
How to use scl enable to run python3 app in dockerfile
Im trying to run a python3 application in a docker container using CentOS 7 as the base image. So if I'm just playing with it interactively, I type scl enable rh-python36 bash That obviously switches ...
1 vote
1 answer
2k views
Docker - execute shell script to export environment variables
I'm trying to export environment variables from a Docker container using a shell script. This script will run a command and save the output as an environment variable. These variables will be used by ...
0 votes
2 answers
2k views
Docker, set to env var file content
How to set to ENV content from file? Something like this: COPY file_with_content.txt ./ ENV MODEL=file_with_content.txt
0 votes
1 answer
939 views
Assignment of environment variables in Dockerfile as a result of a command
I'm trying to asign the result of a powershell command to MY_VAR environment variable. I have tried several ways but I cannot get the variable to take the value of the operation. If I assign the ...
2 votes
2 answers
297 views
Run script before every RUN in Dockerfile?
I have a bit of a weird situation where I need to source the output of a script to set up some environment variables (which are only known at build time) before several RUN steps in my Dockerfile. I ...
0 votes
0 answers
138 views
Can I use a regex or sed to create a dockerfile variable?
I have a Dockerfile that receives a PYTHON_VERSION ARG. I need both the full version for and the major versions only for FROM commands. Something like this: ARG PYTHON_VERSION # assume 3.10.10 FROM ...
1 vote
2 answers
123 views
Docker equivalent of cd /some/th*ng using WORKDIR (wildcard change directory)
In BASH we can change directory to an unknown name, using a * as a wildcard - for example: cd /some/*ing will change directory to cd /some/thing/ (if there is only 1 match for the wildcard) How can we ...