I'm attempting to dockerize a program on Linux OpenWRT, but docker cant find opkg
although I can run opkg
from any path:
Anyways opkg
is in my path /etc , so i started docker from /etc, using WORKDIR ./etc
.
Here is the Dockerfile:
FROM python:3
WORKDIR ./etc
# Setup env
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
# Install pipenv and compilation dependencies & pip itself
#RUN apt-get update
RUN opkg update
#RUN apt-get install -y --no-install-recommends gcc
RUN opkg install -y --no-install-recommends gcc
#RUN apt install -y build-essential libssl-dev libffi-dev python3-dev
RUN opkg install -y --no-install-recommends gcc
#RUN apt install -y python3-pip
RUN opkg install -y python3-pip
#RUN apt install -y python3-venv
RUN opkg install -y python3-venv
#going forward use pip3 to install packages
#setup vitual environment using venv
#change the working dir again to actual program path
WORKDIR /etc/my_program/
RUN mkdir environments
RUN cd environments
RUN python3 -m venv my_env
RUN source my_env/bin/activate
#your python files
ADD hello.py /
# Run the application
CMD ["python3", "./main.py"]
When I run docker build -t my_img .
A snippet of output fails of step 7/18:
Step 7/18 : RUN opkg update
---> Running in da0016984897
/bin/sh: 1: opkg: not found
Why isnt docker finding opkg
when I specifically pointed to /etc
using WORKDIR ./etc
?
How can I fix this?
Thanks