Skip to content

Commit

Permalink
docs: fix bentoml containerize command help message (#2957)
Browse files Browse the repository at this point in the history
Co-authored-by: Sauyon Lee <2347889+sauyon@users.noreply.github.com>
  • Loading branch information
aarnphm and sauyon committed Aug 31, 2022
1 parent 37beaf8 commit f0e0bf0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
13 changes: 9 additions & 4 deletions bentoml/bentos.py
Expand Up @@ -380,7 +380,7 @@ def build_bentofile(
@inject
def containerize(
tag: Tag | str,
docker_image_tag: str | t.List[str] | None = None,
docker_image_tag: t.List[str] | None = None,
*,
add_host: dict[str, str] | None = None,
allow: t.List[str] | None = None,
Expand Down Expand Up @@ -418,7 +418,7 @@ def containerize(

bento = _bento_store.get(tag)
if not docker_image_tag:
docker_image_tag = str(bento.tag)
docker_image_tag = [str(bento.tag)]

dockerfile_path = os.path.join("env", "docker", "Dockerfile")

Expand Down Expand Up @@ -465,9 +465,14 @@ def containerize(
)
return False
else:
logger.info(f'Successfully built docker image "{docker_image_tag}"')
logger.info(
f'To run your newly built Bento container, use: "docker run -it --rm -p 3000:3000 {docker_image_tag}"'
'Successfully built docker image for "%s" with tags "%s"',
str(bento.tag),
",".join(docker_image_tag),
)
logger.info(
'To run your newly built Bento container, use one of the above tags, and pass it to "docker run". i.e: "docker run -it --rm -p 3000:3000 %s"',
docker_image_tag[0],
)
return True

Expand Down
20 changes: 10 additions & 10 deletions bentoml_cli/containerize.py
Expand Up @@ -196,29 +196,29 @@ def containerize( # type: ignore
BENTO is the target BentoService to be containerized, referenced by its name
and version in format of name:version. For example: "iris_classifier:v1.2.0"
`bentoml containerize` command also supports the use of the `latest` tag
'bentoml containerize' command also supports the use of the 'latest' tag
which will automatically use the last built version of your Bento.
You can provide a tag for the image built by Bento using the
`--tag` flag. Additionally, you can provide a `--push` flag,
'--docker-image-tag' flag. Additionally, you can provide a '--push' flag,
which will push the built image to the Docker repository specified by the
image tag.
You can also prefixing the tag with a hostname for the repository you wish
to push to.
e.g. `bentoml containerize IrisClassifier:latest --push --tag
repo-address.com:username/iris` would build a Docker image called
`username/iris:latest` and push that to docker repository at repo-address.com.
e.g. 'bentoml containerize IrisClassifier:latest --push --tag
repo-address.com:username/iris' would build a Docker image called
'username/iris:latest' and push that to docker repository at repo-address.com.
By default, the `containerize` command will use the current credentials
By default, the 'containerize' command will use the current credentials
provided by Docker daemon.
`bentoml containerize` also uses Docker Buildx as backend, in place for normal `docker build`.
'bentoml containerize' also uses Docker Buildx as backend, in place for normal 'docker build'.
By doing so, BentoML will leverage Docker Buildx features such as multi-node
builds for cross-platform images, Full BuildKit capabilities with all of the
familiar UI from `docker build`.
familiar UI from 'docker build'.
We also pass all given args for `docker buildx` through `bentoml containerize` with ease.
We also pass all given args for 'docker buildx' through 'bentoml containerize' with ease.
"""
from bentoml._internal.utils import buildx

Expand Down Expand Up @@ -268,7 +268,7 @@ def containerize( # type: ignore
if platform and len(platform) > 1:
if not push:
logger.warning(
"Multiple `--platform` arguments were found. Make sure to also use `--push` to push images to a repository or generated images will not be saved. For more information, see https://docs.docker.com/engine/reference/commandline/buildx_build/#load."
"Multiple '--platform' arguments were found. Make sure to also use '--push' to push images to a repository or generated images will not be saved. For more information, see https://docs.docker.com/engine/reference/commandline/buildx_build/#load."
)
if push:
load = False
Expand Down

0 comments on commit f0e0bf0

Please sign in to comment.