所以我有一个如下的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
我已经使用dive检查了文件结构,一切都没问题。每个文件都被复制到了它应该在的位置。因此我认为这可能是ENTRYPOINT命令和tini出了错误,因为CMD可以找到并运行该文件。
docker-entrypoint.sh
的第一行是什么?(你可以使用Docker Hubvault
镜像,而不是自己制作镜像吗?) - David Maze#!/bin/sh
,则它应该可以在任何基础镜像上运行。如果您的脚本确实需要zsh,则可能不会默认安装。 - David MazeENTRYPOINT ["/tini", "--", "bash", "/vault/docker-entrypoint.sh"]
- Leopa/vault/docker-entrypoint.sh: line 104: exec: su-exec: not found
第104行是:exec "$@"
- Leopa