Sign inSign up

p3terx/openwrt-build-env

By p3terx

Updated about 5 years ago

OpenWrt build environment in docker

Image
40

100K+

p3terx/openwrt-build-env repository overview

openwrt-build-env

LICENSE GitHub Stars GitHub Forks Docker Stars Docker Pulls GitHub Workflow Status

OpenWrt build environment in docker.

Read the details in my blog (in Chinese) | 中文教程

Usage

Pull or build image
  • 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
    
Run container
docker run \
    -itd \
    --name openwrt-build-env \
    -h P3TERX \
    -p 10022:22 \
    -v ~/openwrt:/home/user/openwrt \
    p3terx/openwrt-build-env
Set the mount directory file permissions
  • Enter the id command 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
    
SSH security settings

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 container
  • Enter from the host.

    docker exec -it openwrt-build-env zsh
    
  • Connect via SSH.

    ssh user@IP -p 10022
    
Clone source code and build
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

Tag summary

Content type

Image

Digest

Size

683.1 MB

Last updated

about 5 years ago

docker pull p3terx/openwrt-build-env