所以我有以下 Dockerfile:
FROM ubuntu:latest
WORKDIR /vault
COPY run.sh /vault/run.sh
COPY docker-entrypoint.sh /vault/docker-entrypoint.sh
COPY config/local.json /vault/config/local.json
COPY logs /vault/logs
COPY file /vault/file
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN chmod +x /vault/run.sh
RUN chmod 777 /vault/docker-entrypoint.sh
RUN apt-get update && apt-get install -y software-properties-common curl gnupg2 && \
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && \
apt-get update && apt-get install -y \
vault bash && \
setcap cap_ipc_lock= /usr/bin/vault
ENTRYPOINT ["/tini", "--" , "/vault/docker-entrypoint.sh"]
#CMD ["sh", "/vault/run.sh"]
文件结构为:
-docker-vault (dir)
|-Dockerfile (file)
|-docker-entrypoint.sh (file)
|-run.sh
|- file (dir)
|- logs (dir)
|- config (dir)
|- local.json
运行 dockerfile 时出现以下错误:
[FATAL tini (8)] exec /vault/docker-entrypoint.sh failed: No such file or directory
我已经尝试用潜水检查文件结构,一切都很好。每个文件都被复制到它所属的地方..所以我认为这可能是 ENTRYPOINT 命令和 tini 的错误,因为 CMD 找到该文件并运行它
答案 0 :(得分:1)
我更新了您的 COPY
和 ENTRYPOINT
命令。
尝试以下 Dockerfile:
FROM ubuntu:latest
WORKDIR /vault
COPY ./run.sh ./run.sh
COPY ./docker-entrypoint.sh ./docker-entrypoint.sh
COPY ./config/local.json ./config/local.json
COPY ./logs ./logs
COPY ./file ./file
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN chmod +x run.sh
RUN chmod 777 docker-entrypoint.sh
RUN apt-get update && apt-get install -y software-properties-common curl gnupg2 && \
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" && \
apt-get update && apt-get install -y \
vault bash && \
setcap cap_ipc_lock= /usr/bin/vault
ENTRYPOINT ["/tini", "--", "bash", "/vault/docker-entrypoint.sh"]