我知道有很多标题相似的问题,但没有一个与我的问题相似。我的问题很简单,我正在尝试使用命令
install_packages
在我的 dockerfile 中安装一些软件包。这会导致权限被拒绝错误,指出 /bin/sh: 1: install_packages: Permission denied
我尝试添加
USER 0
和 USER root
但都不起作用。下面是我的 Dockerfile。我究竟做错了什么?。在 github 中也看到了类似的问题,但那里提供的解决方案对我不起作用。
类似问题:https://github.com/bitnami/bitnami-docker-wordpress/issues/230
Dockerfile:(第六条命令出错)
FROM docker.io/bitnami/minideb:buster
LABEL maintainer "Bitnami <[email protected]>"
USER root
ENV HOME="/" \
OS_ARCH="amd64" \
OS_FLAVOUR="debian-10" \
OS_NAME="linux"
COPY prebuildfs /
# Install required system packages and dependencies
RUN install_packages ca-certificates curl ghostscript gzip imagemagick libc6 libgcc1 libgmp-dev libjemalloc-dev libncurses5-dev libncurses6 libreadline-dev libreadline7 libssl1.1 libstdc++6 libtinfo6 libxml2-dev libxslt1-dev procps tar zlib1g zlib1g-dev
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "ruby" "2.6.6-0" --checksum ecadce77e40822926c69f76cc11437954dd068793548c3f0a21007f9c4fafed3
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "gosu" "1.12.0-0" --checksum 582d501eeb6b338a24f417fededbf14295903d6be55c52d66c52e616c81bcd8c
RUN . /opt/bitnami/scripts/libcomponent.sh && component_unpack "fluentd" "1.10.4-0" --checksum 1428d81be002b7124db38326c73ebe9980e5b3c94a15e3054cdbdff9f8aa3979
RUN apt-get update && apt-get upgrade -y && \
apt-get install build-essential -y && \
rm -r /var/lib/apt/lists /var/cache/apt/archives
COPY rootfs /
RUN /opt/bitnami/scripts/fluentd/postunpack.sh
ENV BITNAMI_APP_NAME="fluentd" \
BITNAMI_IMAGE_VERSION="1.10.4-debian-10-r1" \
GEM_HOME="/opt/bitnami/fluentd" \
PATH="/opt/bitnami/ruby/bin:/opt/bitnami/common/bin:/opt/bitnami/fluentd/bin:$PATH"
#GEM Installation
WORKDIR /opt/bitnami/fluentd
RUN gem install jwk-tool
RUN fluent-gem install 'fluent-plugin-azure-storage-append-blob'
#RUN fluent-gem install 'fluent-plugin-encrypt'
RUN gem install fluent-plugin-jwt-filter && \
gem install json -v "~> 1.8" && \
gem install fluent-plugin-kubernetes && \
gem install fluent-plugin-kubernetes_metadata_filter && \
gem uninstall tzinfo -v 2.0.2
#RUN jwk_tool -g -k key
COPY ./key.pub /opt/bitnami/fluentd/key.pub
EXPOSE 24224 5140
WORKDIR /opt/bitnami/fluentd
#USER 1001
ENTRYPOINT [ "/opt/bitnami/scripts/fluentd/entrypoint.sh" ]
CMD [ "/opt/bitnami/scripts/fluentd/run.sh" ]
默认情况下,用户路径目录中的
install_packages
文件可能未设置为可执行。您可以尝试使用以下命令使其可执行:
chmod +x /usr/sbin/install_packages