Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we use environment variables to set client/server? #5

Open
brimur opened this issue Mar 31, 2020 · 3 comments
Open

Can we use environment variables to set client/server? #5

brimur opened this issue Mar 31, 2020 · 3 comments

Comments

@brimur
Copy link

brimur commented Mar 31, 2020

Hi, I'm using this on a Synology NAS which is all GUI Docker manager so environment variables are the only way to affect a docker on startup. Is it possible to pass in an environment variable to specify server or client + ip? Thanks

@nerdalert
Copy link
Owner

nerdalert commented Apr 14, 2020

Hi @brimur, apologies for the delay. You can definitely pass ENVs.

For example:

$ TARGET=192.168.1.120
$ sudo docker run  -it --rm networkstatic/iperf3 -c $TARGET

Connecting to host 192.168.1.120, port 5201
[  4] local 172.17.0.6 port 39726 connected to 192.168.1.120 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  1.93 GBytes  16.6 Gbits/sec    0    751 KBytes
[  4]   1.00-2.00   sec  1.92 GBytes  16.5 Gbits/sec    0   1.40 MBytes
[  4]   2.00-3.00   sec  2.03 GBytes  17.5 Gbits/sec    0   1.40 MBytes

@brimur
Copy link
Author

brimur commented Apr 15, 2020

Hi @nerdalert, thanks for the reply but what I meant was does it look for variables on startup of the container. The Synology implemention means I can only hit start, I can't actually go into the container and run iperf3, it's run when I start the container. So I was wondering if there was something like, on startup of the container it looks for the environment variable TYPE which can be server or client and if TYPE is client it looks for other variables such as SERVERIP and maybe others like PARALLEL. Np if not, was just curious.

@nerdalert
Copy link
Owner

nerdalert commented Apr 16, 2020

Got it, you definitely can. You would just fork the Dockerfile and add in whatever variables you want. Check out Docker args/envs. Docker docs are meh, this is a simple tutorial. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants