Hello!
Dockerfile for alpine requires a src.tar that is generated by the build.sh script. This removes the possibility to build the image directly from docker-compose:
The log:
/srv/docker/frr /srv/docker/frr
No stopped containers
Building frr
Step 1/14 : FROM alpine:3.7 as source-builder
3.7: Pulling from library/alpine
ff3a5c916c92: Already exists
Digest: sha256:7df6db5aa61ae9480f52f0b3a06a140ab98d427f86d8d5de0bedab9b8df6b1c0
Status: Downloaded newer image for alpine:3.7
---> 3fd9065eaf02
Step 2/14 : ARG commit
---> Running in 168bb9f9317d
Removing intermediate container 168bb9f9317d
---> ae10cc7c9963
Step 3/14 : RUN apk add --no-cache abuild acct alpine-sdk attr autoconf automake bash binutils binutils-libs bison bsd-compat-headers build-base c-ares c-ares-dev ca-certificates cryptsetup-libs curl device-mapper-libs expat fakeroot flex fortify-headers g++ gcc gdbm git gmp isl json-c json-c-dev kmod lddtree libacl libatomic libattr libblkid libburn libbz2 libc-dev libcap libcurl libedit libffi libgcc libgomp libisoburn libisofs libltdl libressl libssh2 libstdc++ libtool libuuid linux-headers lzip lzo m4 make mkinitfs mpc1 mpfr3 mtools musl-dev ncurses-libs ncurses-terminfo ncurses-terminfo-base patch pax-utils pcre perl pkgconf python2 python2-dev readline readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs groff gzip bc py-sphinx
---> Running in 0c0893729674
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/143) Upgrading musl (1.1.18-r2 -> 1.1.18-r3)
(2/143) Installing fakeroot (1.21-r1)
(3/143) Installing sudo (1.8.21_p2-r1)
(4/143) Installing libcap (2.25-r1)
(5/143) Installing pax-utils (1.2.2-r1)
(6/143) Installing libressl2.6-libtls (2.6.3-r0)
(7/143) Installing libressl (2.6.3-r0)
(8/143) Upgrading musl-utils (1.1.18-r2 -> 1.1.18-r3)
(9/143) Installing libattr (2.4.47-r6)
(10/143) Installing attr (2.4.47-r6)
(11/143) Installing tar (1.29-r1)
(12/143) Installing pkgconf (1.3.10-r0)
(13/143) Installing patch (2.7.5-r2)
(14/143) Installing libgcc (6.4.0-r5)
(15/143) Installing libstdc++ (6.4.0-r5)
(16/143) Installing lzip (1.19-r1)
(17/143) Installing ca-certificates (20171114-r0)
(18/143) Installing libssh2 (1.8.0-r2)
(19/143) Installing libcurl (7.59.0-r0)
(20/143) Installing curl (7.59.0-r0)
(21/143) Installing abuild (3.1.0-r3)
Executing abuild-3.1.0-r3.pre-install
(22/143) Installing acct (6.6.4-r0)
(23/143) Installing binutils-libs (2.28-r3)
(24/143) Installing binutils (2.28-r3)
(25/143) Installing gmp (6.1.2-r1)
(26/143) Installing isl (0.18-r0)
(27/143) Installing libgomp (6.4.0-r5)
(28/143) Installing libatomic (6.4.0-r5)
(29/143) Installing mpfr3 (3.1.5-r1)
(30/143) Installing mpc1 (1.0.3-r1)
(31/143) Installing gcc (6.4.0-r5)
(32/143) Installing musl-dev (1.1.18-r3)
(33/143) Installing libc-dev (0.7.1-r0)
(34/143) Installing g++ (6.4.0-r5)
(35/143) Installing make (4.2.1-r0)
(36/143) Installing fortify-headers (0.9-r0)
(37/143) Installing build-base (0.5-r0)
(38/143) Installing expat (2.2.5-r0)
(39/143) Installing pcre2 (10.30-r0)
(40/143) Installing git (2.15.0-r1)
(41/143) Installing lz4-libs (1.8.0-r1)
(42/143) Installing xz-libs (5.2.3-r1)
(43/143) Installing lzo (2.10-r2)
(44/143) Installing squashfs-tools (4.3-r4)
(45/143) Installing libburn (1.4.8-r0)
(46/143) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(47/143) Installing ncurses-terminfo (6.0_p20171125-r0)
(48/143) Installing ncurses-libs (6.0_p20171125-r0)
(49/143) Installing libedit (20170329.3.1-r3)
(50/143) Installing libacl (2.2.52-r3)
(51/143) Installing libisofs (1.4.8-r0)
(52/143) Installing libisoburn (1.4.8-r0)
(53/143) Installing xorriso (1.4.8-r0)
(54/143) Installing lddtree (1.26-r1)
(55/143) Installing libuuid (2.31-r0)
(56/143) Installing libblkid (2.31-r0)
(57/143) Installing device-mapper-libs (2.02.175-r0)
(58/143) Installing cryptsetup-libs (1.7.5-r1)
(59/143) Installing kmod (24-r0)
(60/143) Installing mkinitfs (3.2.0-r2)
Executing mkinitfs-3.2.0-r2.post-install
(61/143) Installing mtools (4.0.18-r2)
(62/143) Installing alpine-sdk (0.5-r0)
(63/143) Installing m4 (1.4.18-r0)
(64/143) Installing libbz2 (1.0.6-r6)
(65/143) Installing perl (5.26.1-r1)
(66/143) Installing autoconf (2.69-r0)
(67/143) Installing automake (1.15.1-r0)
(68/143) Installing readline (7.0.003-r0)
(69/143) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(70/143) Installing bc (1.07.1-r0)
(71/143) Installing bison (3.0.4-r0)
(72/143) Installing bsd-compat-headers (0.7.1-r0)
(73/143) Installing c-ares (1.13.0-r0)
(74/143) Installing c-ares-dev (1.13.0-r0)
(75/143) Installing flex (2.6.4-r1)
(76/143) Installing gdbm (1.13-r1)
(77/143) Installing groff (1.22.3-r2)
(78/143) Installing gzip (1.8-r0)
(79/143) Installing json-c (0.12.1-r1)
(80/143) Installing json-c-dev (0.12.1-r1)
(81/143) Installing libffi (3.2.1-r4)
(82/143) Installing libltdl (2.4.6-r4)
(83/143) Installing libtool (2.4.6-r4)
(84/143) Installing linux-headers (4.4.6-r2)
(85/143) Installing pcre (8.41-r1)
(86/143) Installing py3-olefile (0.43-r2)
(87/143) Installing libpng (1.6.34-r1)
(88/143) Installing freetype (2.8.1-r2)
(89/143) Installing libjpeg-turbo (1.5.2-r0)
(90/143) Installing lcms2 (2.8-r1)
(91/143) Installing openjpeg (2.3.0-r0)
(92/143) Installing sqlite-libs (3.21.0-r0)
(93/143) Installing python3 (3.6.3-r9)
(94/143) Installing tiff (4.0.9-r2)
(95/143) Installing libwebp (0.6.0-r1)
(96/143) Installing py3-pillow (4.3.0-r0)
(97/143) Installing py3-roman (2.0.0-r2)
(98/143) Installing py3-docutils (0.13.1-r0)
(99/143) Installing py3-markupsafe (1.0-r0)
(100/143) Installing py3-jinja2 (2.9.6-r0)
(101/143) Installing py3-pygments (2.2.0-r0)
(102/143) Installing py3-six (1.11.0-r0)
(103/143) Installing py3-sphinx_rtd_theme (0.2.4-r0)
(104/143) Installing py3-alabaster (0.7.10-r0)
(105/143) Installing py3-tz (2017.3-r0)
(106/143) Installing py3-babel (2.5.1-r0)
(107/143) Installing py3-snowballstemmer (1.2.1-r1)
(108/143) Installing py3-imagesize (0.7.1-r2)
(109/143) Installing py3-chardet (3.0.4-r0)
(110/143) Installing py3-idna (2.6-r0)
(111/143) Installing py3-certifi (2017.7.27.1-r1)
(112/143) Installing py3-urllib3 (1.22-r0)
(113/143) Installing py3-requests (2.18.4-r0)
(114/143) Installing py3-sphinxcontrib-websupport (1.0.1-r3)
(115/143) Installing py3-sphinx (1.6.5-r0)
(116/143) Installing py-sphinx (1.6.5-r0)
(117/143) Installing python2 (2.7.14-r2)
(118/143) Installing py2-olefile (0.43-r2)
(119/143) Installing py2-pillow (4.3.0-r0)
(120/143) Installing py2-roman (2.0.0-r2)
(121/143) Installing py2-docutils (0.13.1-r0)
(122/143) Installing py2-markupsafe (1.0-r0)
(123/143) Installing py2-jinja2 (2.9.6-r0)
(124/143) Installing py2-pygments (2.2.0-r0)
(125/143) Installing py2-six (1.11.0-r0)
(126/143) Installing py2-sphinx_rtd_theme (0.2.4-r0)
(127/143) Installing py2-alabaster (0.7.10-r0)
(128/143) Installing py2-tz (2017.3-r0)
(129/143) Installing py2-babel (2.5.1-r0)
(130/143) Installing py2-snowballstemmer (1.2.1-r1)
(131/143) Installing py2-imagesize (0.7.1-r2)
(132/143) Installing py2-chardet (3.0.4-r0)
(133/143) Installing py2-idna (2.6-r0)
(134/143) Installing py2-certifi (2017.7.27.1-r1)
(135/143) Installing py2-urllib3 (1.22-r0)
(136/143) Installing py2-requests (2.18.4-r0)
(137/143) Installing py2-sphinxcontrib-websupport (1.0.1-r3)
(138/143) Installing py2-typing (3.6.2-r0)
(139/143) Installing py2-sphinx (1.6.5-r0)
(140/143) Installing python2-dev (2.7.14-r2)
(141/143) Installing libhistory (7.0.003-r0)
(142/143) Installing readline-dev (7.0.003-r0)
(143/143) Installing texinfo (6.5-r0)
Executing busybox-1.27.2-r7.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 475 MiB in 152 packages
Removing intermediate container 0c0893729674
---> 3f4027cad625
Step 4/14 : RUN mkdir -p /src
---> Running in b903d2acbc5d
Removing intermediate container b903d2acbc5d
---> 5f1eff7c0585
Step 5/14 : ADD src.tar /src
ERROR: Service 'frr' failed to build: ADD failed: stat /var/lib/docker/tmp/docker-builder443225818/src.tar: no such file or directory
/srv/docker/frr
The docker-compose.yaml file:
version: '3.5'
services:
frr:
build:
context: https://github.com/FRRouting/frr.git
dockerfile: docker/alpine/Dockerfile
restart: always
logging:
driver: journald
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- bgp_as65000
expose:
- "179"
networks:
bgp_as65000:
name: bgp_as65000
Can you please avoid the src.tar generation outside docker and instead, add git to apk add and clone it inside the container? Or at least another folder with a friendly version of Dockerfile for direct composer compilation?
Thanks!
Thanks for trying this out, I'll have a look later on tonight...
Hello!
Thanks a lot @ajones-rvbd ! If you want some help or testing, I'm ready to try!
Looking into this now... Looks like there are 2 different features here:
1) add the ability to build the apk packages in docker without requiring a script (directly from the repo)
2) create a "base" frr docker image that can be built using the build functionality of docker-compose and build this image without requiring a script.
I think both asks are definitely improvements and I hope are pretty easy without really changing what we have much, so I'll give it a shot. I'll probably do one at a time, we'll see...
BTW: thanks @leleobhz for the offer to help test...
I've created the branch ajones-issue-2024 over on my fork here:
https://github.com/ajones-rvbd/frr
I'll let you know when I have something ready to test (probably tomorrow)...
Hi @leleobhz, give this docker-compose.yml a try:
version: '3.5'
services:
frr:
build:
context: https://github.com/ajones-rvbd/frr.git#ajones-issue-2024
dockerfile: docker/alpine/Dockerfile
entrypoint: [ 'sleep', '10000' ]
seems to work for me. It's very rough, the daemons are not started, but they are there...
Also, the commits will need to be cleaned up quite a bit and a section in the docs for docker-compose usage will be necessary, but the core content should be there...
Let me know what you think...
Hello @ajones-rvbd !
In someplace of compilation, file utility was missing for ./configure.
That said, its compiling here. A bit slow, but its compiling. Ill send the complete log here if you want.
Thanks!
Hello!
Here is the log of build: issue2024.txt
The files involved:
[root@manaira frr]# cat docker-compose.yaml
version: '3.5'
services:
frr:
build:
context: https://github.com/ajones-rvbd/frr.git#ajones-issue-2024
dockerfile: docker/alpine/Dockerfile
restart: always
logging:
driver: journald
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- bgp_as65000
expose:
- "179"
entrypoint: ['sh']
networks:
bgp_as65000:
name: bgp_as65000
[root@manaira frr]# cat upgradeImage.sh
#!/bin/bash
pushd $(dirname ${BASH_SOURCE[0]})
if [[ -f local.sh && -x local.sh ]];
then
source local.sh
fi
/usr/local/bin/docker-compose rm -svf
/usr/local/bin/docker-compose pull
/usr/local/bin/docker-compose up --build --remove-orphans ${@}
popd
P.s: I know the sock volume export is not needed. Its just a junk from other unit :/
Thanks @leleobhz ! I'm cleaning up the docs and patch, I'll rebase, test and submit. Thanks for testing and for the idea for a nice cleanup of the build scripts, I'll add you to the PR...
There is still a ways to go before the base image is usable, but this is a great step forward. Definitely looking forward to your input on what the packaging should look like. There is a nice template in the aports repo with quagga and we have templates from frr in the redhat and debianpkg directories...
Fix is merged to master, I think this can be closed. @leleobhz , what do you think? Good enough for now?
Hello @ajones-rvbd !
I've tested you image and there is somethings I noticed:
[root@manaira ~]# docker exec -it frr_frr_1 sh
/ # frr-reload
Please install frr-pythontools package. Required for reload
/ # bgpd
privs_init: could not lookup user frr
/ # id frr
id: unknown user frr
/ #
This frr-pythontools cannot be installed? Or this does not make sense in containerized context?
Also, this frr user is a must have? Since I'm starting with this image, Ill do some testings, but to do not keep this useless opened, you can close it and I report again if I found something.
Just for record, Ive used the following compose file:
[root@manaira frr]# cat docker-compose.yaml
version: '3.5'
services:
frr:
build:
context: https://github.com/FRRouting/frr.git
dockerfile: docker/alpine/Dockerfile
restart: always
logging:
driver: journald
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- bgp_as65000
expose:
- "179"
entrypoint: ['sleep', '15d']
networks:
bgp_as65000:
name: bgp_as65000
Hi @leleobhz , frr user is one of things I need to fix in the packaging, you can get around it by specifying root user on the command line (bgpd -u root).
Not sure about frr-reload, I haven't used that before...
I'll go ahead and close this one, feel free to open more issues as you start to get things working...
Looks like I don't have permission to close this, maybe you do @leleobhz ?
Hello @ajones-rvbd !
Ill do it. Just for notice: I ran entrypoint: ['bgpd', '-n', '-S', '-p', '179'] and manually in the sh it worked. Im compiling the following composer right now:
[root@manaira frr]# cat docker-compose.yaml
version: '3.5'
services:
bgpd_65000:
build:
context: https://github.com/FRRouting/frr.git
dockerfile: docker/alpine/Dockerfile
restart: always
container_name: as65000
logging:
driver: journald
volumes:
- /srv/storage/frr/bgpd/01.conf:/usr/etc/bgpd.conf
networks:
- bgp_as65000
expose:
- "179"
entrypoint: ['bgpd', '-n', '-S', '-p', '179']
bgpd_65001:
build:
context: https://github.com/FRRouting/frr.git
dockerfile: docker/alpine/Dockerfile
restart: always
container_name: as65001
logging:
driver: journald
volumes:
- /srv/storage/frr/bgpd/02.conf:/usr/etc/bgpd.conf
networks:
- bgp_as65000
expose:
- "179"
entrypoint: ['bgpd', '-n', '-S', '-p', '179']
networks:
bgp_as65000:
name: bgp_as65000
[root@manaira frr]# cat /srv/storage/frr/bgpd/01.conf
router bgp 65000
bgp router-id 192.168.10.11
network 192.168.10.0/24
neighbor upstream peer-group
neighbor upstream remote-as 65001
neighbor upstream capability dynamic
neighbor upstream prefix-list pl-allowed-adv out
neighbor as65001 peer-group upstream
neighbor as65001 description ACME ISP
!
ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
ip prefix-list pl-allowed-adv seq 10 deny any
[root@manaira frr]# cat /srv/storage/frr/bgpd/02.conf
router bgp 65001
bgp router-id 192.168.11.11
network 192.168.11.0/24
neighbor upstream peer-group
neighbor upstream remote-as 65001
neighbor upstream capability dynamic
neighbor upstream prefix-list pl-allowed-adv out
neighbor as65000 peer-group upstream
neighbor as65000 description ACME ISP
!
ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25
ip prefix-list pl-allowed-adv seq 10 deny any
[root@manaira frr]#
Ill not follow this tests here. If needed, I'll send you a email you used for Signature-off in the commit.
Thanks!!!!