Monthly Archives: February 2018

Accessing gpio pins inside a docker container on a raspberry pi

If your container needs access to the GPIO pins, then it must have access to the /dev/gpiomem device. From the command line you can do that like this:

$ docker run --device=/dev/gpiomem:/dev/gpiomem of commandline...

Here’s how to do it with a docker-compose file:

version: "2"

      - /dev/gpiomem:/dev/gpiomem
    ports: of the file...