如何在 bitnami/prometheus 图像上安装 bash?
How to install bash on a bitnami/prometheus image?
我正在尝试使用没有 shell 的 bitnami/prometheus container which, according to its documentation, is based on the minideb 容器映像。我想安装一个 Bash shell 用于调试目的。我注意到这直接适用于 bitnami/minideb
图像,即以下 Dockerfile,
FROM bitnami/minideb:latest
RUN install_packages bash
构建成功:
> docker build -t prometheus .
[+] Building 7.8s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 96B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/bitnami/minideb:latest 2.8s
=> [1/2] FROM docker.io/bitnami/minideb:latest@sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 0.0s
=> => resolve docker.io/bitnami/minideb:latest@sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 0.0s
=> => sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 741B / 741B 0.0s
=> => sha256:aeb2b928697a7e94189f3faf4cf18f3b505a907ab7df55924e763147524c96f6 528B / 528B 0.0s
=> => sha256:591c594084e5b5c2636b2d41b8626ae3f6624b2b5db93fb6a881a08cc93f14f9 910B / 910B 0.0s
=> [2/2] RUN install_packages bash 4.8s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:9e1a4250e9ff3de115d9f286c904b5aa4da5ba5f0234336a5c22c2d31ce203be 0.0s
=> => naming to docker.io/library/prometheus 0.0s
但是,如果我使用 bitnami/prometheus
而不是 bitnami/minideb
,
FROM bitnami/prometheus:latest
RUN install_packages bash
由于缺少目录,尝试构建它会导致错误 /var/lib/apt/lists/partial
:
> docker build -t prometheus .
[+] Building 0.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 99B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/bitnami/prometheus:latest 0.0s
=> CACHED [1/2] FROM docker.io/bitnami/prometheus:latest 0.0s
=> ERROR [2/2] RUN install_packages bash 0.3s
------
> [2/2] RUN install_packages bash:
#5 0.230 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
#5 0.230 apt failed, retrying
#5 0.242 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
#5 0.243 apt failed, retrying
#5 0.255 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
------
executor failed running [/bin/sh -c install_packages bash]: exit code: 100
知道如何在 bitnami/prometheus
上安装 Bash 吗?
默认情况下,图像 bitnami/prometheus 已经有 bash。您可以 运行 使用 docker run -d bitnami/prometheus:latest
图像 bitnami/prometheus 并使用 docker ps
获取 CONTAINER_ID 然后使用命令检查
docker exec -it CONTAINER_ID /bin/bash
如果要安装其他包,请在 Dockerfile 中使用以下命令
FROM bitnami/prometheus:latest
RUN apt install package_name
我正在尝试使用没有 shell 的 bitnami/prometheus container which, according to its documentation, is based on the minideb 容器映像。我想安装一个 Bash shell 用于调试目的。我注意到这直接适用于 bitnami/minideb
图像,即以下 Dockerfile,
FROM bitnami/minideb:latest
RUN install_packages bash
构建成功:
> docker build -t prometheus .
[+] Building 7.8s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 96B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/bitnami/minideb:latest 2.8s
=> [1/2] FROM docker.io/bitnami/minideb:latest@sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 0.0s
=> => resolve docker.io/bitnami/minideb:latest@sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 0.0s
=> => sha256:643da48745542c1b8e51a9b79beabc958731c4b539e1fa2261475c69d8e2058e 741B / 741B 0.0s
=> => sha256:aeb2b928697a7e94189f3faf4cf18f3b505a907ab7df55924e763147524c96f6 528B / 528B 0.0s
=> => sha256:591c594084e5b5c2636b2d41b8626ae3f6624b2b5db93fb6a881a08cc93f14f9 910B / 910B 0.0s
=> [2/2] RUN install_packages bash 4.8s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:9e1a4250e9ff3de115d9f286c904b5aa4da5ba5f0234336a5c22c2d31ce203be 0.0s
=> => naming to docker.io/library/prometheus 0.0s
但是,如果我使用 bitnami/prometheus
而不是 bitnami/minideb
,
FROM bitnami/prometheus:latest
RUN install_packages bash
由于缺少目录,尝试构建它会导致错误 /var/lib/apt/lists/partial
:
> docker build -t prometheus .
[+] Building 0.4s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 99B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/bitnami/prometheus:latest 0.0s
=> CACHED [1/2] FROM docker.io/bitnami/prometheus:latest 0.0s
=> ERROR [2/2] RUN install_packages bash 0.3s
------
> [2/2] RUN install_packages bash:
#5 0.230 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
#5 0.230 apt failed, retrying
#5 0.242 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
#5 0.243 apt failed, retrying
#5 0.255 E: List directory /var/lib/apt/lists/partial is missing. - Acquire (2: No such file or directory)
------
executor failed running [/bin/sh -c install_packages bash]: exit code: 100
知道如何在 bitnami/prometheus
上安装 Bash 吗?
默认情况下,图像 bitnami/prometheus 已经有 bash。您可以 运行 使用 docker run -d bitnami/prometheus:latest
图像 bitnami/prometheus 并使用 docker ps
获取 CONTAINER_ID 然后使用命令检查
docker exec -it CONTAINER_ID /bin/bash
如果要安装其他包,请在 Dockerfile 中使用以下命令
FROM bitnami/prometheus:latest
RUN apt install package_name