DarthSim / overmind

Process manager for Procfile-based applications and tmux
MIT License
2.78k stars 79 forks source link

Permission denied running with docker #136

Closed elalemanyo closed 10 months ago

elalemanyo commented 1 year ago

Hi, I am trying to replace foreman with overmind. All my dev setup is running with Docker evilmartians/ruby-on-whales setup. To get overmind running I add some changes to my Dockerfile

  1. Add go
    
    COPY --from=golang:1.19.1-bullseye /usr/local/go/ /usr/local/go/

ENV GOPATH=$HOME/go ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin


2. Install `tmux` using `apt-get`
3. Install `overmind`:

RUN go install github.com/DarthSim/overmind/v2@latest



This is working, but when I try to start all Processes I get `Permission denied` 😔
<img width="649" alt="shot2022-09-30 at 10 55 20@2x" src="https://user-images.githubusercontent.com/3856862/193233054-8e8e8538-effb-47d3-bb43-124daf470b86.png">

What am I doing wrong?

Thanks
DarthSim commented 1 year ago

Hi @elalemanyo! Unfortunately, I can't reproduce the issue. Could show the whole Dockerfile?

elalemanyo commented 1 year ago

@DarthSim yes! of course.

ARG PROJECT_RUBY_VERSION
ARG DISTRO_NAME=bullseye

FROM ruby:$PROJECT_RUBY_VERSION-slim-$DISTRO_NAME

COPY --from=golang:1.19.1-bullseye /usr/local/go/ /usr/local/go/

ENV GOPATH=$HOME/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin

ARG PROJECT_NAME
ARG DISTRO_NAME

# Common dependencies
RUN apt-get update -qq \
  && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
    build-essential \
    gnupg2 \
    curl \
    less \
    git \
    libzmq3-dev \
    file \
    rsync \
    tmux \
  && apt-get clean \
  && rm -rf /var/cache/apt/archives/* \
  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
  && truncate -s 0 /var/log/*log

RUN go install github.com/DarthSim/overmind/v2@latest

ARG PROJECT_PG_MAJOR
RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgres-archive-keyring.gpg \
  && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/postgres-archive-keyring.gpg] https://apt.postgresql.org/pub/repos/apt/" \
    $DISTRO_NAME-pgdg main $PROJECT_PG_MAJOR | tee /etc/apt/sources.list.d/postgres.list > /dev/null
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
  DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
    libpq-dev \
    postgresql-client-$PROJECT_PG_MAJOR \
    && apt-get clean \
    && rm -rf /var/cache/apt/archives/* \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
    && truncate -s 0 /var/log/*log

ARG PROJECT_NODE_MAJOR
RUN curl -sL https://deb.nodesource.com/setup_$PROJECT_NODE_MAJOR.x | bash -
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
  DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
    nodejs \
    && apt-get clean \
    && rm -rf /var/cache/apt/archives/* \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
    && truncate -s 0 /var/log/*log

ARG PROJECT_YARN_VERSION
RUN npm install -g yarn@$PROJECT_YARN_VERSION

# Configure bundler
ENV LANG=C.UTF-8 \
  BUNDLE_JOBS=4 \
  BUNDLE_RETRY=3

# Store Bundler settings in the project's root
ENV BUNDLE_APP_CONFIG=.bundle

# Uncomment this line if you want to run binstubs without prefixing with `bin/` or `bundle exec`
# ENV PATH /app/bin:$PATH

# Upgrade RubyGems and install the latest Bundler version
RUN gem update --system && \
    gem install bundler

# Create a directory for the app code
RUN mkdir -p /$PROJECT_NAME
WORKDIR /$PROJECT_NAME
DarthSim commented 1 year ago

I built an image from this Dockerfile, and still can't reproduce the issue 😓 Could you try to replace entries in your Procfile with something 100% working like sleep 100?

manuelvanrijn commented 11 months ago

@elalemanyo I've had the same issue. Did you maybe also use a tmpfs for the /tmp folder? By default, tmpfs doesn't support executing files from it, so I had to add :exec in my docker-compose.yml file like this:

x-tmpfs: &tmpfs
  tmpfs:
-    - /tmp
+    - /tmp:exec
elalemanyo commented 11 months ago

@elalemanyo I've had the same issue. Did you maybe also use a tmpfs for the /tmp folder? By default, tmpfs doesn't support executing files from it, so I had to add :exec in my docker-compose.yml file like this:

x-tmpfs: &tmpfs
  tmpfs:
-    - /tmp
+    - /tmp:exec

oh! I would try that, thanks. BTW how are you installing overwind in your docker image? Is there a simple way to do this? In this case I start from a ruby image.

manuelvanrijn commented 10 months ago

oh! I would try that, thanks. BTW how are you installing overwind in your docker image? Is there a simple way to do this? In this case I start from a ruby image.

Wasn't there yet, but I think my approach would be something like:

FROM golang:1.21.0-alpine AS builder
RUN go install github.com/DarthSim/overmind/v2@latest

FROM alpine:latest
COPY --from=builder /go/bin/overmind /usr/local/bin/overmind

btw I think we can close this issue because it's docker/config related :)