Set environment path inside docker container

In windows, I have set an environment path to “D:\FFMPEG\bin” so that it is accessible in cmd. How can I do the same inside a docker container?

Attempt 1 - Inside docker file, I did - ENV PATH="D:\FFMPEG\bin:${PATH}". Also did
ENV PATH=".\FFMPEG\bin:${PATH}"
Attempt 2 - In my docker-compose.yml, I did -

env_file:
      - ./.env

my .env has - FFMPEG_PATH=./FFmpeg/bin

How can I set an environment path inside the container, like in windows?
Dockerfile

FROM python:3.8.5

ENV APP_HOME /app

WORKDIR $APP_HOME

COPY . /app

RUN apt-get update -y && apt-get install -y --no-install-recommends build-essential gcc libsndfile1

RUN pip install -r requirements.txt

RUN pip install python-dotenv

ENTRYPOINT ["python"]

CMD ["app.py"]

docker-compose.yml

version: "3.9"

services:

  web:

    build: .

    ports:

      - "5000:5000"

    volumes:

      - ".:/app"

    env_file:

      - ./.env

Folder structure

Heroku
  app.py
  Dockerfile
  docker-compose.yml
  FFMPEG
      bin
         ffmpeg.exe

Thank you.

ENV PATH="$PATH:$JAVA_HOME/bin" should do the job. (As an example)
But does "D:\FFMPEG\bin exist in your container? This looks like a windows path and most containers are linux containers.

1 Like