Skip to content

Not possible to pass arguments when doing docker run #1448

@LarsAlmgren

Description

@LarsAlmgren

We're building an image like this:
BUILD:

filegroup(
    name = "entrypoint",
    srcs = [
        "entrypoint.sh",
    ],
)

pkg_tar(
    name = "entrypoint_tar",
    srcs = [
        ":entrypoint",
    ],
    mode = "0755",
    package_dir = "app"
)

container_image(
    name = "docker",
    base = "@google-cloud-sdk//image",
    entrypoint = "/app/entrypoint.sh",
    tars = [
        ":entrypoint_tar",
    ],
)

entrypoint.sh:

#!/usr/bin/env bash

set -ex

... some auth

bq "$@"

When running this locally with docker run bazel/task-images/bigquery:docker --help we see that the arguments are not passed to the entrypoint script:

$ docker run bazel/task-images/bigquery:docker --help
+ bq

If skip instead run by specifying the entrypoint like docker run --entrypoint /app/entrypoint.sh bazel/task-images/bigquery:docker --help we see that the arguments are passed:

$ docker run --entrypoint /app/entrypoint.sh bazel/task-images/bigquery:docker --help
+ bq --help

Not sure if this is an intended behaviour or not (and also not sure it should go here), but could not find any info when looking around.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Can Close?Will close in 30 days unless there is a comment indicating why not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions