Use docker to build openwrt aa
Table of Contents
1 Prepare docker project
1.1 Create empty directory pineapple-proj
mkdir pineapple-proj
cd pineaple-proj
1.2 Put Dockerfile and sources.list to pineapple-proj
1.2.1 Dockerfile content
FROM ubuntu:12.04 # aliyun mirrors in China COPY sources.list /etc/apt/ ENV TERM=xterm-256color RUN apt-get update \ && apt-get install -y gcc g++ binutils patch bzip2 flex bison make \ autoconf gettext texinfo unzip sharutils subversion ncurses-term \ zlib1g-dev gawk asciidoc git-core build-essential libssl-dev \ mercurial libncurses5-dev vim wget \ && apt-get clean \ && groupadd -g 1000 xyz \ && useradd -u 1000 -g 1000 -G sudo -m xyz \ && mkdir /home/xyz/pineapple \ && chown xyz:xyz /home/xyz/pineapple \ && echo "root:123" | chpasswd \ && chsh -s /bin/bash xyz USER xyz WORKDIR /home/xyz ENV TERM=xterm-256color MAINTAINER Kevin Chen
1.2.2 aliyun apt sources.list
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
2 Build the Dockerfile and tag the Image as ubu12-pineapple
sudo docker build -t ubu12-pineapple .
after the operation, check the images:
➜ pineapple-proj sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE ubu12-pineapple latest b39a342214ce 4 minutes ago 1.12GB ubuntu 12.04 5b117edd0b76 4 months ago 104MB
3 Create container with docker run
# -t : allocate a pseudo-tty # -i : keep STDIN open even if not attached # --name : assign a name to the container # -v : create a bind mount, if you specify, -v /HOST-DIR:/CONTAINER-DIR sudo docker run -it --name c-pineapple -v ~/workspace/moon/pineapple-git/sdk_aa/:/home/xyz/pineapple ubu12-pineapple
4 Start container with docker start
After the c-pineapple container created, when it stopped, use docker start
to start the pineapple container.
# -a : attach STDOUT/STDERR and forward signals # -i : attach container's STDIN sudo docker start -ai c-pineapple