There is an issue in the specification of the bentofile.yaml file, specifically in the docker section where the env entry is defined. When the BENTOML_CONFIG environment variable is specified in the env entry, the BentoML service fails to start in a Docker container.
Steps to reproduce:
git clone this repo, keep the bentofile.yml as is (so the BENTOML_CONFIG environment variable in the env entry of the bentofile.yaml file is defined as /.config/default.yaml
Build and containerize the BentoML service using the bentoml build and bentoml containerize commands.
ECR_REPO=...
TAG=latest
SERVICE_NAME=transformers-nlp-service-gpu
bentoml build && bentoml containerize "${SERVICE_NAME}" -t "${ECR_REPO}:${TAG}"
Run the Docker container using the docker run command.
docker run --rm -p 3000:3000 "${ECR_REPO}:${TAG}"
Expected behavior:
The BentoML service should start in the Docker container without any issues.
Actual behavior:
The BentoML service fails to start in the Docker container and the following error message is displayed:
Traceback (most recent call last): File "/usr/local/bin/bentoml", line 5, in from bentoml_cli.cli import cli File "/usr/local/lib/python3.9/site-packages/bentoml_cli/cli.py", line 57, in cli = create_bentoml_cli() File "/usr/local/lib/python3.9/site-packages/bentoml_cli/cli.py", line 20, in create_bentoml_cli from bentoml._internal.context import component_context File "/usr/local/lib/python3.9/site-packages/bentoml/init.py", line 25, in load_config() File "/usr/local/lib/python3.9/site-packages/bentoml/_internal/configuration/init.py", line 143, in load_config raise FileNotFoundError( FileNotFoundError: BentoML config file specified in ENV VAR not found: 'BENTOML_CONFIG=./config/default.yaml'
Proposed solution: Update the bentofile.yaml file to remove the env entry and provide instructions on how to set the BENTOML_CONFIG environment variable when running the Docker container.
versions
python 3.9.11
os: ubuntu 24
bentoml 1.1.6