Build OpenWrt in Docker Container

Hi,

I had problems building OpenWrt on Linux systems with some host libraries being too new.
That's why I build OpenWrt in a Docker container:

Just something I like to share - in case you run into similar problems. - have fun!

5 Likes

I have a similar setup. Not because I ran into any issues on my host distribution, but simply because I don't need to have all these development packages installed on my workstation. I use Debian Stretch as a base for my container, though. Aside from that, what do you need sudo for inside the container?

I failed to compile lede 17.0.1 on ubuntu:18.04. Maybe (Debian) stretch has the same problem, but jessie seems to work well.

Thanks regarding the sudo, I have removed it.

Building the image locally fails (master branch)

...
Processing triggers for sgml-base (1.26+nmu4) ...

/bin/sh: 1: cannot create /etc/sudoers.d/user: Directory nonexistent

The command '/bin/sh -c apt-get update &&    apt-get install -y time git-core subversion build-essential g++ bash make libssl-dev patch &&     apt-get install -y libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python &&     apt-get clean &&     useradd -m user &&     echo 'user ALL=NOPASSWD: ALL' > /etc/sudoers.d/user &&     mkdir /home/user/build' returned a non-zero code: 2

@fbradyirl fixed. I had to revert the sudo removal.
@silentcreek I think sudo is useful in case someone need to install some dependency (for testing).

Sure, but you have to keep in mind that if you make changes inside the container, they are lost once you shutdown the container and restart it.

Therefor I simply change my Dockerfile and rebuild the container, when I miss a dependency.