Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 18 commits ahead of fcollova:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Micropython on ESP8266

The repository provides a Dockerfile to build the Micropython firmware for ESP8266 boards.

Based on THiNX OpenSource IoT management platform.

Warning: The binary works on Ubuntu 14:04 and the build is based on Ubuntu 14:04

Build Instructions

Build the docker image of the master branch.

  docker build -t micropython .

To specify a particular version of micropython provide it through the build-arg. Otherwise the HEAD of the master branch will be used.

  docker build -t micropython --build-arg VERSION=v1.8.7 .

Once the container is built successfuly create a container from the image

  docker create --name micropython micropython

Then copy the the built firmware into the host machine.

  docker cp micropython:/micropython/esp8266/build/firmware-combined.bin firmware-combined.bin

The firmware can then be uploaded with the esptool --port ${SERIAL_PORT} --baud 115200 write_flash --verify --flash_size=8m 0 firmware-combined.bin

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected.

Flash from within Container

If you have built the image directly on your host (Linux), you also can flash your ESP directly by running a container from the image. I prefereably erase flash memory of ESP8266 before starting flash a new firmware

docker run --rm -it --device ${SERIAL_PORT} --user root --workdir /micropython/esp8266 micropython make PORT=${SERIAL_PORT} erase deploy

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected, generally is equal to /dev/ttyUSB0.

Freeze personal script files in the build

If you want to add personal python scripts to include in the build flash image, you have to add them to the folder /micropython/esp8266/modules. The building process will precompiles your scripts with MPY and will inserts in the flash image this option will save you more memory of the microcontroller.

To obtain this within the docker container, create a copy of the original micropython folder /micropython/esp8266/modules in your working directrory add here your scripts and link them into the container (with the -v docker option) overriding the default modules folder, when you run the container.

docker run --rm -it -v $(pwd)/modules:/micropython/esp8266/modules --device ${SERIAL_PORT} --user root --workdir /micropython/esp8266 esp /bin/bash
make clean
make PORT=/dev/ttyUSB0 erase deploy

Here ${SERIAL_PORT} is the path to the serial device on which the board is connected, generally is equal to /dev/ttyUSB0.


Build environment for ESP8266 micropython






No packages published


  • Python 94.6%
  • Shell 3.3%
  • Dockerfile 2.1%