Search code examples
dockerdocker-compose

docker-compose adding to PATH


I need to add some paths to my PATH in docker-compose.yml

in docker-compose.yml I have tried

app:
    ...
    environment:
        - PATH /code/project

however that just overwrites the existing PATH - whereas I want to add to the existing PATH


Solution

  • to add a single location to PATH in your docker-compose.yml file:

    app
        environment:
            - PATH=/code/project:$PATH
    

    to add multiple locations to your PATH in your docker-compose.yml file

    app
        environment:
            - PATH=/code/project:/code/lib:/foo/bar:$PATH
    

    to add to your PYTHONPATH

    app
        environment:
            - PYTHONPATH=/code/project:/code/lib:/foo/bar