Antonio Sanchez
Antonio Sanchez

Reputation: 391

Docker deploy in Heroku error - Permission denied

I want to deploy a web page in Heroku using Docker. I have two entrypoints

ENTRYPOINT ["/app/entrypoint.sh"]
ENTRYPOINT ["/app/yt_bot.py"]

The first entrypoint works perfectly

enter image description here

But when it reaches the second entrypoint, it throws an error: Permission denied

enter image description here

This is the code of yt_bot.py:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.youtube.com/')

I've installed the Firefox web driver in usr/local/bin. Could the error be related to that?

EDIT

This is my Dockerfile:

FROM debian:stretch
# Install git, supervisor, VNC, & X11 packages
RUN set -ex; \
    apt-get update; \
    apt -y install python-pip; \
    pip install selenium; \
    apt-get -y install wget; \
    wget https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-linux64.tar.gz; \
    tar xvf geckodriver-v0.29.1-linux64.tar.gz; \
    mv geckodriver usr/local/bin; \
    rm geckodriver-v0.29.1-linux64.tar.gz; \
    export PATH=$PATH:/usr/local/bin/geckodriver; \
    wget https://download1320.mediafire.com/p27lunltbdqg/vu5daioshg687nx/yt_bot.py; \
    apt-get install -y \
      bash \
      fluxbox \
      git \
      net-tools \
      novnc \
      socat \
      supervisor \
      x11vnc \
      xterm \
      xvfb
ENV HOME=/root \
    DEBIAN_FRONTEND=noninteractive \
    LANG=en_US.UTF-8 \
    LANGUAGE=en_US.UTF-8 \
    LC_ALL=C.UTF-8 \
    DISPLAY=:0.0 \
    DISPLAY_WIDTH=1024 \
    DISPLAY_HEIGHT=768 \
    RUN_XTERM=yes \
    RUN_FLUXBOX=yes
COPY . /app
RUN chmod +x /app/conf.d/websockify.sh
ENTRYPOINT ["/app/entrypoint.sh"]
ENTRYPOINT ["/app/yt_bot.py"]

Upvotes: 3

Views: 1000

Answers (1)

Mostafa Ghadimi
Mostafa Ghadimi

Reputation: 6736

Add the following line to your Dockerfile in order to run the commands as root user.

...
USER root # add this line before entry points
ENTRYPOINT ["/app/entrypoint.sh"]
ENTRYPOINT ["/app/yt_bot.py"]

Upvotes: 2

Related Questions