OpenWrt build environment in docker.
Read the details in my blog (in Chinese) | 中文教程
-
Pull image from docker hub.
docker pull p3terx/openwrt-build-env
-
Build image.
docker build -t p3terx/openwrt-build-env github.com/P3TERX/openwrt-build-env
docker run \
-itd \
--name openwrt-build-env \
-h P3TERX \
-p 10022:22 \
-v ~/openwrt:/home/user/openwrt \
p3terx/openwrt-build-env-
Enter the
idcommand to check UID and GID$ id uid=1001(p3terx) gid=1002(p3terx)
-
Modify the UID and GID
docker exec openwrt-build-env sudo usermod -u 1001 user docker exec openwrt-build-env sudo groupmod -g 1002 user
-
Modify the file ownership
docker exec openwrt-build-env sudo chown -hR user:user .
-
Restart container
docker restart openwrt-build-env
The default SSH user name and password is user. If you are making the container accessible from the internet you'll probably want to secure it bit. You can do one of the following two things after launching the container:
-
Change password:
docker exec -it openwrt-build-env sudo passwd user -
Don't allow passwords at all, use keys instead:
docker cp ~/.ssh/authorized_keys openwrt-build-env:/home/user/.ssh docker exec openwrt-build-env sudo chown user:user /home/user/.ssh/authorized_keys docker exec openwrt-build-env sudo sed -i '/PasswordAuthentication /c\PasswordAuthentication no' /etc/ssh/sshd_config docker restart openwrt-build-env
-
Enter from the host.
docker exec -it openwrt-build-env zsh -
Connect via SSH.
ssh user@IP -p 10022
git clone https://github.com/openwrt/openwrt
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make download -j8
make V=s