[GH-ISSUE #112] Docker image doesn't support ENV variables #80

Closed
opened 2026-03-03 16:04:16 +03:00 by kerem · 11 comments
Owner

Originally created by @paskal on GitHub (Feb 16, 2018).
Original GitHub issue: https://github.com/mthenw/frontail/issues/112

Hello, $subj.

Work with such images from docker-compose is a pain;(

Here is an example of image which use ENV variables and doesn't require to add command to run:
https://github.com/siomiz/SoftEtherVPN
Here is one of the variables from it:

➜  SoftEtherVPN git:(master)  fgrep PSK . -r
./copyables/gencert.sh:PSK=
./copyables/entrypoint.sh:: ${PSK:='notasecret'}
./copyables/entrypoint.sh:/opt/vpncmd localhost /SERVER /CSV /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:no /PSK:${PSK} /DEFAULTHUB:DEFAULT
./README.md:- `-e PSK`: Pre-Shared Key (PSK), if not set: "notasecret" (without quotes) by default.
./README.md:The output will have `CERT` and `KEY` already filled in. Modify `PSK`/`USERS`.

How do I use it:

[root@server ~]# cat softethervpn.env
USERS=user:password
PSK=itsasecret

[root@server ~]# fgrep softethervpn docker-compose.yml -A1
    softethervpn:
        image: siomiz/softethervpn
        hostname: softethervpn
        restart: always
        container_name: softethervpn
        env_file: ../softethervpn.env

I've spent two hours trying to make your image work with .env file (passing variables as command) but didn't had any luck with it. Would you be so kind to write an entrypoint for your image which will check if variables are set, and pass them if they are?

Originally created by @paskal on GitHub (Feb 16, 2018). Original GitHub issue: https://github.com/mthenw/frontail/issues/112 Hello, $subj. Work with such images from docker-compose is a pain;( Here is an example of image which use ENV variables and doesn't require to add `command` to run: https://github.com/siomiz/SoftEtherVPN Here is one of the variables from it: ``` ➜ SoftEtherVPN git:(master) fgrep PSK . -r ./copyables/gencert.sh:PSK= ./copyables/entrypoint.sh:: ${PSK:='notasecret'} ./copyables/entrypoint.sh:/opt/vpncmd localhost /SERVER /CSV /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:no /PSK:${PSK} /DEFAULTHUB:DEFAULT ./README.md:- `-e PSK`: Pre-Shared Key (PSK), if not set: "notasecret" (without quotes) by default. ./README.md:The output will have `CERT` and `KEY` already filled in. Modify `PSK`/`USERS`. ``` How do I use it: ``` [root@server ~]# cat softethervpn.env USERS=user:password PSK=itsasecret [root@server ~]# fgrep softethervpn docker-compose.yml -A1 softethervpn: image: siomiz/softethervpn hostname: softethervpn restart: always container_name: softethervpn env_file: ../softethervpn.env ``` I've spent two hours trying to make your image work with .env file (passing variables as `command`) but didn't had any luck with it. Would you be so kind to write an entrypoint for your image which will check if variables are set, and pass them if they are?
kerem closed this issue 2026-03-03 16:04:16 +03:00
Author
Owner

@mthenw commented on GitHub (Feb 16, 2018):

Hey,

can you make a PR?

<!-- gh-comment-id:366233945 --> @mthenw commented on GitHub (Feb 16, 2018): Hey, can you make a PR?
Author
Owner

@mthenw commented on GitHub (Feb 16, 2018):

Docker file is located here: https://github.com/mthenw/docker-frontail

<!-- gh-comment-id:366234093 --> @mthenw commented on GitHub (Feb 16, 2018): Docker file is located here: https://github.com/mthenw/docker-frontail
Author
Owner

@paskal commented on GitHub (Feb 16, 2018):

I'll give it a shot. If you don't mind, I prefer to move docker file here (there is no need for separate repo) and I could suggest you how to set up autobuild every time you push a new tag.

<!-- gh-comment-id:366236691 --> @paskal commented on GitHub (Feb 16, 2018): I'll give it a shot. If you don't mind, I prefer to move docker file here (there is no need for separate repo) and I could suggest you how to set up autobuild every time you push a new tag.
Author
Owner

@mthenw commented on GitHub (Feb 16, 2018):

It's already setup there. Please make it there and I will move it afterwards.

<!-- gh-comment-id:366237398 --> @mthenw commented on GitHub (Feb 16, 2018): It's already setup there. Please make it there and I will move it afterwards.
Author
Owner

@paskal commented on GitHub (Feb 24, 2018):

I'm stuck:) In Go world we just read env variables in program:
long:"pinszie" env:"PIN_SIZE" default:"5" description:"pin size"
In this example, if PIN_SIZE is set, it will be used (if nothing passed as parameter to command itself).

entrypoint.sh I've linked initially doesn't seem to be a standard, it's a huge hack which couldn't be taken from projects I know as-is - it's highly customized bash code. The general idea here could be to parse environment variables, and construct input parameters string to your application in right order. It's possible to do but kind of ugly when you have full control on application source code.

Could you please check if there is a way in your application to use environment variables without some script passing them to it? I don't know how hard it will be, but I'm sure that's the right way to accomplish proper Docker integration.

<!-- gh-comment-id:368214180 --> @paskal commented on GitHub (Feb 24, 2018): I'm stuck:) In Go world we just read env variables in [program](https://github.com/umputun/secrets/blob/master/app/main.go): `long:"pinszie" env:"PIN_SIZE" default:"5" description:"pin size"` In this example, if PIN_SIZE is set, it will be used (if nothing passed as parameter to command itself). `entrypoint.sh` I've [linked](https://github.com/siomiz/SoftEtherVPN/blob/master/copyables/entrypoint.sh) initially doesn't seem to be a standard, it's a huge hack which couldn't be taken from projects I know as-is - it's highly customized bash code. The general idea here could be to parse environment variables, and construct input parameters string to your application in right order. It's possible to do but kind of ugly when you have full control on application source code. Could you please check if there is a way in your application to use environment variables without some script passing them to it? I don't know how hard it will be, but I'm sure that's the right way to accomplish proper Docker integration.
Author
Owner

@mthenw commented on GitHub (Mar 14, 2018):

What exactly you would like to pass as env var?

<!-- gh-comment-id:372978523 --> @mthenw commented on GitHub (Mar 14, 2018): What exactly you would like to pass as env var?
Author
Owner

@paskal commented on GitHub (Mar 14, 2018):

Basically everything what could be passed as args, all options plus filepath itself.

<!-- gh-comment-id:372979412 --> @paskal commented on GitHub (Mar 14, 2018): Basically everything what could be passed as args, all options plus filepath itself.
Author
Owner

@mthenw commented on GitHub (Mar 14, 2018):

OK, so I didn't understand your original request. I think this change should be done in frontail itself, not in docker image. Or you can just simply create your own docker image doing that.

<!-- gh-comment-id:372981220 --> @mthenw commented on GitHub (Mar 14, 2018): OK, so I didn't understand your original request. I think this change should be done in frontail itself, not in docker image. Or you can just simply create your own docker image doing that.
Author
Owner

@paskal commented on GitHub (Mar 14, 2018):

Yes, that's right - change should be done in frontail itself. Doing this in separate shell script inside docker is possible but ugly - I've stopped trying when understood what it will be wrong to do so.

<!-- gh-comment-id:372983410 --> @paskal commented on GitHub (Mar 14, 2018): Yes, that's right - change should be done in frontail itself. Doing this in separate shell script inside docker is possible but ugly - I've stopped trying when understood what it will be wrong to do so.
Author
Owner

@timdonovanuk commented on GitHub (Jun 3, 2020):

Not sure why closed, I can't see that env vars are supported. The original request was badly described, but usualy docker containers can be started with env vars such as:

docker run --rm \
      -e INFLUXDB_DB=db0 \
      -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword \
      -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword \
      -v $PWD:/var/lib/influxdb \
      influxdb /init-influxdb.sh

rather than passing a --comand. So env vars that map to options available would be great!

<!-- gh-comment-id:638105965 --> @timdonovanuk commented on GitHub (Jun 3, 2020): Not sure why closed, I can't see that env vars are supported. The original request was badly described, but usualy docker containers can be started with env vars such as: ``` docker run --rm \ -e INFLUXDB_DB=db0 \ -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword \ -e INFLUXDB_USER=telegraf -e INFLUXDB_USER_PASSWORD=secretpassword \ -v $PWD:/var/lib/influxdb \ influxdb /init-influxdb.sh ``` rather than passing a --comand. So env vars that map to options available would be great!
Author
Owner

@timdonovanuk commented on GitHub (Jun 3, 2020):

Or support for a config_file.yaml :)

<!-- gh-comment-id:638106238 --> @timdonovanuk commented on GitHub (Jun 3, 2020): Or support for a config_file.yaml :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/frontail#80
No description provided.