-
Notifications
You must be signed in to change notification settings - Fork 2k
Use Docker to build RIOT
Docker is a platform that allows packaging software into containers that can easily be run on any Linux that has Docker installed.
You can download a RIOT Docker container from the Docker Hub and then use that to build your project making use of all toolchains that we've preinstalled in the container.
First, install Docker. Probably sudo apt-get install docker
(or equivalent) will be all you need.
You need to have permission to access the Docker daemon. There are two ways:
- Your OS distribution may create a group called
docker
. If so, then adding yourself to that group (and logging out and in again) should grant you permission. - Execute docker with sudo. This is in fact the most secure and recommended setup (see here, here, here and here). No extra setup steps are needed.
make
should be instructed to usesudo
by settingDOCKER="sudo docker"
in the command line.
Then, download the pre-built RIOT Docker container:
# docker pull riot/riotbuild
This will take a while. If it finishes correctly, you can then use the toolchains contained in the Docker container: (from the riot root):
$ docker run --rm -i -t -u $UID -v $(pwd):/data/riotbuild riot/riotbuild ./dist/tools/compile_test/compile_test.py
The RIOT build system provides support for using the Docker container to build RIOT projects, so you do not need to type the long docker command line every time:
(from the directory you would normally run make, e.g. examples/default)
$ make BUILD_IN_DOCKER=1
If your user does not have permissions to access the Docker daemon:
$ make BUILD_IN_DOCKER=1 DOCKER="sudo docker"
to always use Docker for building, set BUILD_IN_DOCKER=1
(and if necessary DOCKER="sudo docker"
) in the environment:
$ export BUILD_IN_DOCKER=1
running make without specifying BUILD_IN_DOCKER=1
will still use Docker (because of the environment variable)
On some Ubuntu versions a make with BUILD_IN_DOCKER=1 cant resolve the host name of for example github.com. To fix this add the file /etc/docker/daemon.json with the address of your DNS Server.