harbor icon indicating copy to clipboard operation
harbor copied to clipboard

Add environmental variables

Open JanLauGe opened this issue 5 years ago • 2 comments

First of all, thank you for your work on this package!

I am trying to run docker containers that require environmental variables. In bash, the command would be something like docker run --env SOME_VARIABLE_1=some_value_1 --env SOME_VARIABLE_2=some_value_2 my_docker_image. However, I am strugling to make this work in harbor. I've tried the versions below to no avail. Is this supported? Where am I going wrong?

harbor::docker_run(
  image = 'my_docker_image',
  docker_opts = c(
    'SOME_VARIABLE_1' = 'some_value_1',
    'SOME_VARIABLE_2' = 'some_value_2')
  capture_text = TRUE)

harbor::docker_run(
  image = 'my_docker_image',
  docker_opts = '--env SOME_VARIABLE_1=some_value_1 --env SOME_VARIABLE_2=some_value_2)
  capture_text = TRUE)

Thanks a lot in advance for your help

JanLauGe avatar Nov 21 '19 14:11 JanLauGe

Hi @JanLauGe (I hope @wch won't mind me pointing to another package, AFAIK harbor is not under active development anymore.),

have you taken a look at stevedore? https://cran.r-project.org/package=stevedore

There is an env argument in docker$container$create(..).

nuest avatar Nov 25 '19 07:11 nuest

Cool, thanks for pointing this out! My workaround in the meantime was to use the python module docker and the reticulate packagewhich did the trick as well. I'll definitively check outstevedore` as well, thank you!

JanLauGe avatar Dec 01 '19 17:12 JanLauGe