A Docker container for building and flashing ESP32 applications
2.4K
This Dockerfile contains the dependencies necessary to build and flash programs for the ESP32 chip.
docker pull bschwind/esp-32-buildcd to your esp-32 projectdocker run --rm -it -v $(PATH_TO_ESP_IDF):/esp/esp-idf -v $(PATH_TO_YOUR_PROJECT):/esp/project bschwind/esp-32-build /bin/bashdocker run --rm -it --privileged -v /dev/bus/usb:/dev/bus/usb -v $(PATH_TO_ESP_IDF):/esp/esp-idf -v $(PATH_TO_YOUR_PROJECT):/esp/project bschwind/esp-32-build /bin/bashEither step will put you in an interactive shell inside the container. If you have a Makefile in your project directory, you can immediately
run make and your source should get compiled. make flash will attempt to flash the code to /dev/ttyUSB0.
If you're on docker-machine (OS X or Windows), you need to forward your USB device within Virtualbox. This is best managed in the VirtualBox GUI.
Steps:
docker-machine start <YOUR_DOCKER_VM_NAME>docker run --rm -it --privileged -v /dev/bus/usb:/dev/bus/usb -v $(PWD):/esp/project bschwind/esp-32-build /bin/bash
-v /dev/bus/usb:/dev/bus/usb volume, the /dev/bus/usb on the lefthand side of the colon refers to docker VM's USB directory, not your host machine (you likely won't find that path on OS X)/dev/ttyUSB0 should now be availablemake and then make flash on an example project or your ownIf you're on Linux, it should be sufficient to share your USB device either as a docker volume or with the --device flag. However, I have not yet tested Linux.
Picocom is installed in this image by default. Invoke it with picocom -b 115200 /dev/ttyUSB0 (change the baud rate and device path accordingly)
Stop it with Ctrl-A Ctrl-X
You can change the baud rate and other properties with make menuconfig which will drop you in esp-idf's project configuration menu. I recommend selecting a baud rate of 921600 as it will reduce flashing times to around 4-5 seconds.
docker pull bschwind/esp-32-buildcd to your esp-32 projectdocker create -v /mnt/ccache:/ccache --name ccache bschwind/esp-32-builddocker run --rm -it -v $(PATH_TO_ESP_IDF):/esp/esp-idf -v $(PATH_TO_YOUR_PROJECT):/esp/project -e CCACHE_DIR=/ccache --volumes-from ccache bschwind/esp-32-build /bin/bashContent type
Image
Digest
Size
209.2 MB
Last updated
over 8 years ago
docker pull bschwind/esp-32-build