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

bug: env variables not injected in bento container #4885

Open
rlleshi opened this issue Jul 28, 2024 · 4 comments
Open

bug: env variables not injected in bento container #4885

rlleshi opened this issue Jul 28, 2024 · 4 comments
Labels
feedback-wanted Request for feedback

Comments

@rlleshi
Copy link
Contributor

rlleshi commented Jul 28, 2024

Describe the bug

As per the docs here, env variables should be injected in the resulting docker container. However, these variables are not actually being injected and are not available inside the container at runtime.

To reproduce

No response

Expected behavior

Env variables defined via the bentofile should be injected inside the container.

Although it appears that they are actually injected when defined inside the env attribute of the docker attribute inside the bentofile.

Is the documentation perhaps outdated?

Environment

bentoml: 1.2.16
python: 3.9.0
platform: ubuntu 22.04

@rlleshi rlleshi added the bug Something isn't working label Jul 28, 2024
@aarnphm
Copy link
Contributor

aarnphm commented Jul 28, 2024

I can't seem to reproduce this with bentoml 1.3
Screenshot 2024-07-28 at 16 14 54

As you can see here, the env HF_TOKEN is injected correctly from bentofile.yaml:

service: 'service:VLLM'
labels:
  owner: bentoml-team
  stage: demo
include:
  - '*.py'
  - 'bentovllm_openai/*.py'
python:
  requirements_txt: './requirements.txt'
  lock_packages: false
envs:
  - name: HF_TOKEN
docker:
  python_version: 3.11

@frostming frostming added feedback-wanted Request for feedback and removed bug Something isn't working labels Jul 31, 2024
@rlleshi
Copy link
Contributor Author

rlleshi commented Aug 6, 2024

Hi @aarnphm this seems to be happening when you define the docker.env field.

So if you have a different set of variables on envs and you define another set of variables on docker.env, then the variables of envs are not taken into account.

service: "service:TestService"
include:
  - "*.py"
envs:
  - name: "TEST_ENV"
    value: "test"
docker:
  distro: debian
  python_version: "3.10"
  env:
    TEST_ENV_2: "test"

TEST_ENV won't be available during runtime.

@aarnphm
Copy link
Contributor

aarnphm commented Aug 7, 2024

@frostming iirc the docker.env will be deprecated soon in light of envs?

Should we print out a warning then for now just merge the docker env to the above env?

@rlleshi
Copy link
Contributor Author

rlleshi commented Sep 4, 2024

that would be helpful as I ended up wasting quite a bit of time on this

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

No branches or pull requests

3 participants