I’ve searched for long, and i found it strange i cannot find a solution.
I create a docker container like this:
docker run -dit --name test -w /project espressif/idf bash
Then i try to build my app like:
docker exec -it test idf.py build
but idf.py is not recognized.
If i rerun the entrypoint, everything is fine but it takes some extra seconds everytime i do a build:
docker exec -dit test /opt/esp/entrypoint.sh idf.py build
But if i do:
docker run -it --name test -w /project espressif/idf bash
and do:
idf.py build
many times, I have the entrypoint variables working fine.
So, my question is: can i use the terminal that is create at my first run command every time and keeping in this way my variables:
docker run -dit --name test -w /project espressif/idf bash
Alternative Solution: Can i set only some paths and never run the export.sh file?
ESP-IDF Docker: Keep env variables from entrypoint
Re: ESP-IDF Docker: Keep env variables from entrypoint
If you just want to build you should be able to use the command as described in the image documentation:
When you do exec you are not running in the same context where the entrypoint script executed on your docker "run" which exported all of the env variables for idf.py build. That's why that doesn't work. So you either have to do it the way you are or use docker run for every command you want to execute individually.
You mount in your source and it will be built. If you want to do full development in a docker container (I personally love this approach) with IDF I recommend something like VSCode that has a full dev integration with Docker via Dev Containers.
Code: Select all
docker run --rm -v $PWD:/project -w /project espressif/idf:latest idf.py build
You mount in your source and it will be built. If you want to do full development in a docker container (I personally love this approach) with IDF I recommend something like VSCode that has a full dev integration with Docker via Dev Containers.
Re: ESP-IDF Docker: Keep env variables from entrypoint
That's true. It took me sometime to understand how the entrypoint script works in esp-idf containers.When you do exec you are not running in the same context where the entrypoint script executed on your docker "run" which exported all of the env variables for idf.py build. That's why that doesn't work. So you either have to do it the way you are or use docker run for every command you want to execute individually.
The best solution i found is to `docker run -dit --name something --rm -v $PWD:/project -w /project espressif/idf:latest`
and then whenever i want to build i do `docker attach something` do my `idf.py build` stuff, and press the escape buttons to go back to my host.
Who is online
Users browsing this forum: No registered users and 88 guests