Search code examples
dockerdockerfiletini

Docker tini no such file or direcory


so i have following 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"]

And the file structure is:

-docker-vault (dir)
|-Dockerfile (file)
|-docker-entrypoint.sh (file)
|-run.sh
|- file (dir)
|- logs (dir)
|- config (dir)
   |- local.json

And i get the following error when running the dockerfile:

[FATAL tini (8)] exec  /vault/docker-entrypoint.sh failed: No such file or directory

I already tried to check the file structure with dive and everything was fine. every file was copied where it belongs to.. so i thought this may be an error with the ENTRYPOINT command and tini, since CMD finds the file and runs it

Here is the dive: Dive Results


Solution

  • I updated your COPY and ENTRYPOINT commands.

    Try the following 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"]