Sqush merge latest code to github branch

This commit is contained in:
Qi Luo 2016-05-27 13:30:13 -07:00
parent 537242d213
commit 85f354b77b
23 changed files with 413 additions and 75 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "docker-base"]
path = docker-base
url = https://github.com/Azure/sonic-docker-base.git

View File

@ -33,6 +33,7 @@ The root is disabled, but the created user could sudo.
./build_docker.sh docker-bgp
./build_docker.sh docker-snmp
./build_docker.sh docker-lldp
./build_docker.sh docker-basic_router
# Contribution guide

View File

@ -61,7 +61,7 @@ mkdir -p $FILESYSTEM_ROOT
## Build a basic Debian system by debootstrap
echo '[INFO] Debootstrap...'
sudo debootstrap --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian
sudo debootstrap --variant=minbase --arch amd64 jessie $FILESYSTEM_ROOT http://ftp.us.debian.org/debian
## Config hostname and hosts, otherwise 'sudo ...' will complain 'sudo: unable to resolve host ...'
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '$HOSTNAME' > /etc/hostname"
@ -82,11 +82,13 @@ clean_sys() {
$FILESYSTEM_ROOT/sys/fs/cgroup \
$FILESYSTEM_ROOT/sys || true
}
trap_push 'sudo umount $FILESYSTEM_ROOT/sys || true'
trap_push clean_sys
sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs
## Pointing apt to public apt mirrors and getting latest packages, needed for latest security updates
sudo cp files/sources.list $FILESYSTEM_ROOT/etc/apt/
sudo cp docker-base/sources.list $FILESYSTEM_ROOT/etc/apt/
sudo cp files/apt/apt.conf.d/81norecommends $FILESYSTEM_ROOT/etc/apt/apt.conf.d/
sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'apt-mark auto `apt-mark showmanual`'
## Note: set lang to prevent locale warnings in your chroot
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y update
@ -129,7 +131,6 @@ curl -sSL https://get.docker.com/ | sudo LANG=C chroot $FILESYSTEM_ROOT sh
## Remove garbage left by docker installation script
sudo rm $FILESYSTEM_ROOT/etc/apt/sources.list.d/docker.list
sudo chroot $FILESYSTEM_ROOT service docker stop
sudo chroot $FILESYSTEM_ROOT service dbus stop
## Add docker config drop-in to select aufs, otherwise it may other storage driver
## Note: $_ means last argument of last command
sudo mkdir -p $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/
@ -149,16 +150,23 @@ sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \
## Note: gdisk is needed for sgdisk in install.sh
## Note: parted is needed for partprobe in install.sh
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \
file \
ifupdown \
iproute2 \
isc-dhcp-client \
sudo \
vim \
tcpdump \
ntp \
ntpstat \
openssh-server \
python \
python-setuptools \
rsyslog \
python-apt \
gdisk \
parted \
traceroute \
iputils-ping \
net-tools \
efibootmgr
## docker-py is needed by Ansible docker module
@ -167,9 +175,6 @@ sudo LANG=C chroot $FILESYSTEM_ROOT pip install 'docker-py==1.6.0'
## Remove pip which is unnecessary in the base image
sudo LANG=C chroot $FILESYSTEM_ROOT pip uninstall -y pip
echo '[INFO] Install apt-transport-sftp package from deps directory'
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install libssh2-1
## Config DHCP for eth0
sudo tee -a $FILESYSTEM_ROOT/etc/network/interfaces > /dev/null <<EOF
@ -178,10 +183,13 @@ allow-hotplug eth0
iface eth0 inet dhcp
EOF
sudo cp files/dhcp/rfc3442-classless-routes $FILESYSTEM_ROOT/etc/dhcp/dhclient-exit-hooks.d
## Clean up apt
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get clean
sudo LANG=C chroot $FILESYSTEM_ROOT rm -rf /tmp/*
sudo LANG=C chroot $FILESYSTEM_ROOT bash -c 'rm -rf /usr/share/doc/* /usr/share/locale/* /var/lib/apt/lists/* /tmp/*'
## Umount all
echo '[INFO] Umount all'
@ -195,6 +203,8 @@ sudo mkdir $FILESYSTEM_ROOT/host
## Compress most file system into squashfs file
sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS
## Output the file system total size for diag purpose
sudo du -hs $FILESYSTEM_ROOT
sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker
## Compress together with /boot and /var/lib/docker as an installer payload zip file

View File

@ -20,6 +20,7 @@ REGISTRY_PASSWD=$5
## Docker image label, so no need to remember its hash
docker_image_name=$DOCKER_BUILD_DIR
remote_image_name=$REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name
## File name for docker image
docker_image_gz=$docker_image_name.gz
@ -32,30 +33,42 @@ docker_image_gz=$docker_image_name.gz
function cleanup {
rm -rf $DOCKER_BUILD_DIR/files
rm -rf $DOCKER_BUILD_DIR/deps
docker rmi -f $docker_image_name || true
docker rmi $remote_image_name || true
}
trap cleanup exit
## Copy dependencies
## Note: Dockerfile ADD doesn't support reference files outside the folder, so copy it locally
if ls deps/* 1>/dev/null 2>&1; then
mkdir -p $DOCKER_BUILD_DIR/deps
cp deps/*.deb $DOCKER_BUILD_DIR/deps
cp -r deps/* $DOCKER_BUILD_DIR/deps
fi
## Copy the suggested Debian sources
## ref: https://wiki.debian.org/SourcesList
mkdir -p $DOCKER_BUILD_DIR/files
cp files/sources.list $DOCKER_BUILD_DIR/files
docker build -t $docker_image_name $DOCKER_BUILD_DIR
cp -r files $DOCKER_BUILD_DIR/files
docker build --no-cache -t $docker_image_name $DOCKER_BUILD_DIR
## Flatten the image by importing an exported container on this image
## Note: it will squash the image with only one layer and lost all metadata such as ENTRYPOINT,
## so apply only to the base image
## TODO: wait docker-squash supporting Docker 1.10+
## ref: https://github.com/jwilder/docker-squash/issues/45
if [ "$docker_image_name" = "docker-base" ]; then
tmp_container=$(docker run -d ${docker_image_name} /bin/bash)
docker export $tmp_container | docker import - ${docker_image_name}
docker rm -f $tmp_container || true
fi
if [ -n "$REGISTRY_SERVER" ] && [ -n "$REGISTRY_PORT" ]; then
## Add registry information as tag, so will push as latest
## Temporarily add -f option to prevent error message of Docker engine version < 1.10.0
docker tag -f $docker_image_name $REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name
docker tag -f $docker_image_name $remote_image_name
## Login the docker image registry server
## Note: user name and password are passed from command line, use fake email address to bypass login check
docker login -u $REGISTRY_USERNAME -p "$REGISTRY_PASSWD" -e "@" $REGISTRY_SERVER:$REGISTRY_PORT
docker push $REGISTRY_SERVER:$REGISTRY_PORT/$docker_image_name
docker push $remote_image_name
fi
docker save $docker_image_name | gzip -c > $docker_image_gz

View File

@ -13,7 +13,7 @@
}
## Retrieval short version of Git revision hash for partition metadata
[ -z $(git status --untracked-files=no -s) ] || {
[ -z "$(git status --untracked-files=no -s)" ] || {
echo "Error: There is local changes not committed to git repo. Cannot get a revision hash for partition metadata."
exit 1
}

1
docker-base Submodule

@ -0,0 +1 @@
Subproject commit 915f0fc71276e8819107edf605ab891764a01870

View File

@ -0,0 +1,17 @@
FROM docker-base
MAINTAINER Xudong Wu
## Set the apt source
RUN apt-get clean && apt-get update
COPY deps /deps
RUN dpkg -i /deps/libopennsl_*.deb; \
dpkg -i /deps/libsaibcm_*.deb; \
apt-get -y install -f
RUN mv /deps/basic_router /usr/sbin/basic_router
ENTRYPOINT service rsyslog start \
&& /bin/bash

View File

@ -1,17 +1,12 @@
FROM debian:jessie
## Set the apt source
COPY files/sources.list /etc/sources.list
RUN apt-get clean && apt-get update
## Pre-install the fundamental packages
RUN apt-get -y install \
rsyslog \
python
FROM docker-base
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service quagga start \
&& /bin/bash

View File

@ -1,14 +1,14 @@
FROM debian:jessie
## Set the apt source
COPY files/sources.list /etc/sources.list
RUN apt-get clean && apt-get update
FROM docker-base
## Pre-install the fundamental packages
RUN apt-get -y install \
rsyslog \
RUN apt-get update && apt-get -y install \
redis-server
ENTRYPOINT service rsyslog start \
&& service redis-server start \
&& /bin/bash
RUN sed -ri 's/^daemonize yes$/daemonize no/' /etc/redis/redis.conf \
&& sed -ri 's/^logfile .*$/logfile ""/' /etc/redis/redis.conf \
&& sed -ri 's/^# syslog-enabled no$/syslog-enabled no/' /etc/redis/redis.conf
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
ENTRYPOINT service redis-server start

21
docker-fpm/Dockerfile Executable file
View File

@ -0,0 +1,21 @@
FROM docker-base
RUN apt-get update
COPY deps /deps
## Get fpmsyncd
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb
COPY /deps/fpmsyncd /usr/local/bin/fpmsyncd
## Get Quagga
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/quagga_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service quagga start \
&& (fpmsyncd &) \
&& /bin/bash

View File

@ -1,12 +1,7 @@
FROM debian:jessie
## Set the apt source
COPY files/sources.list /etc/sources.list
RUN apt-get clean && apt-get update
FROM docker-base
## Pre-install the fundamental packages
RUN apt-get -y install \
rsyslog \
RUN apt-get update && apt-get -y install \
lldpd
COPY deps /deps
@ -18,6 +13,21 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
## Note: dpkg_apt function has the benefit to detect missing .deb file
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/lldpsyncd_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
## There is a known bug: agetty processes at 100% cpu
## When:
## 1. running container in --privileged mode
## 2. container runs /sbin/init
## ref: https://github.com/docker/docker/issues/4040
## Temporary solution:
## Disable tty services permanently
RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask
## Note: getty@.service in last grep output will not mask below cases
RUN systemctl mask getty@tty1.service
## Specify init as CMD to enable systemd
## Note: don't provide ENTRYPOINT at the same time
CMD ["/sbin/init"]

View File

@ -0,0 +1,38 @@
FROM docker-base
## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
## Pre-install the fundamental packages
RUN apt-get update \
&& apt-get -y install \
net-tools
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/python-tabulate_*.deb \
&& dpkg_apt /deps/applibs_*.deb \
&& dpkg_apt /deps/applibs-dev_*.deb \
&& dpkg_apt /deps/sx-complib_*.deb \
&& dpkg_apt /deps/sxd-libs_*.deb \
&& dpkg_apt /deps/sx-scew_*.deb \
&& dpkg_apt /deps/sx-examples_*.deb \
&& dpkg_apt /deps/sx-gen-utils_*.deb \
&& dpkg_apt /deps/python-sdk-api_*.deb \
&& dpkg_apt /deps/sx-libnl_*.deb \
&& dpkg_apt /deps/iproute2_*.deb \
&& dpkg_apt /deps/libsswsdk_*.deb \
&& dpkg_apt /deps/libthrift-0.9.2_*.deb \
&& dpkg_apt /deps/libthrift-dev_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/mlnx-sai_*.deb \
&& dpkg_apt /deps/sswsyncd-saithrift_*.deb
## Clean up
RUN apt-get clean -y ; apt-get autoclean -y ; apt-get autoremove -y ; rm -rf /deps
ENTRYPOINT service rsyslog start \
&& mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \
&& service sswsyncd start \
&& /bin/bash

30
docker-mlnx-sswsyncd/Dockerfile Executable file
View File

@ -0,0 +1,30 @@
FROM docker-base
RUN apt-get update
## Pre-install the fundamental packages
RUN apt-get update \
&& apt-get -y install \
net-tools
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/applibs-dev_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-complib_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sxd-libs_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-scew_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-examples_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-gen-utils_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-sdk-api_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sx-libnl_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/iproute2_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/mlnx-sai_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb
ENTRYPOINT service rsyslog start \
&& mkdir -p /dev/sxdevs && ( [ -e /dev/sxdevs/sxcdev ] || mknod /dev/sxdevs/sxcdev c 231 193 ) \
&& sleep 5 && service sswsyncd start \
&& /bin/bash

22
docker-orchagent/Dockerfile Executable file
View File

@ -0,0 +1,22 @@
FROM docker-base
RUN apt-get update
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb
## TODO: add ifupdown into Depends
RUN apt-get install -f -y ifupdown
## Copy executable binaries
COPY ["/deps/orchagent","/deps/swssconfig","/deps/portsyncd","/deps/intfsyncd","/deps/neighsyncd","/usr/local/bin/"]
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& /bin/bash

View File

@ -0,0 +1,16 @@
FROM docker-base
## Pre-install the fundamental packages
RUN apt-get update && apt-get -y install \
smartmontools \
sensord
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service lm-sensors start \
&& service smartmontools start \
&& service sensord start \
&& /bin/bash

View File

@ -1,12 +1,7 @@
FROM debian:jessie
## Set the apt source
COPY files/sources.list /etc/sources.list
RUN apt-get clean && apt-get update
FROM docker-base
## Pre-install the fundamental packages
RUN apt-get -y install \
rsyslog \
RUN apt-get update && apt-get -y install \
snmp \
snmpd
@ -18,6 +13,25 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return
## Install SNMP subagent
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/acs-snmp-subagent_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
## There is a known bug: agetty processes at 100% cpu
## When:
## 1. running container in --privileged mode
## 2. container runs /sbin/init
## ref: https://github.com/docker/docker/issues/4040
## Temporary solution:
## Disable tty services permanently
RUN systemctl --no-pager list-unit-files --type=service | grep getty | awk '{print $1}' | xargs systemctl mask
## Note: getty@.service in last grep output will not mask below cases
RUN systemctl mask getty@tty1.service
## Although exposing ports is not need for host net mode, keep it for possible bridge mode
EXPOSE 161/udp
EXPOSE 162/udp
## Specify init as CMD to enable systemd
## Note: don't provide ENTRYPOINT at the same time
CMD ["/sbin/init"]

View File

@ -1,22 +1,18 @@
FROM debian:jessie
FROM docker-base
## Set the apt source
COPY files/sources.list /etc/sources.list
RUN apt-get clean && apt-get update
## Pre-install the fundamental packages
## TODO: sswsyncd depends on ifupdown
RUN apt-get -y install \
python \
ifupdown \
rsyslog
RUN apt-get update
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/python-tabulate_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsswsdk_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/sswsyncd_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service sswsyncd start \
&& /bin/bash

33
docker-syncd-mlnx/Dockerfile Executable file
View File

@ -0,0 +1,33 @@
FROM docker-base
RUN apt-get update
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/applibs_*.deb \
&& dpkg_apt /deps/applibs-dev_*.deb \
&& dpkg_apt /deps/sx-complib_*.deb \
&& dpkg_apt /deps/sxd-libs_*.deb \
&& dpkg_apt /deps/sx-scew_*.deb \
&& dpkg_apt /deps/sx-examples_*.deb \
&& dpkg_apt /deps/sx-gen-utils_*.deb \
&& dpkg_apt /deps/python-sdk-api_*.deb \
&& dpkg_apt /deps/sx-libnl_*.deb \
&& dpkg_apt /deps/iproute2_*.deb \
&& dpkg_apt /deps/mft*.deb \
&& dpkg_apt /deps/libhiredis0.13*.deb \
&& dpkg_apt /deps/libswsscommon_*.deb \
&& dpkg_apt /deps/mlnx-sai_*.deb \
&& dpkg_apt /deps/libsairedis_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service syncd start \
&& /bin/bash

24
docker-syncd/Dockerfile Executable file
View File

@ -0,0 +1,24 @@
FROM docker-base
RUN apt-get update
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libhiredis0.13*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libswsscommon_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libopennsl_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsaibcm_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/libsairedis_*.deb
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /deps/syncd_*.deb
## TODO: add kmod into Depends
RUN apt-get install -f kmod
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
ENTRYPOINT service rsyslog start \
&& service syncd start \
&& /bin/bash

36
docker-vas/Dockerfile Executable file
View File

@ -0,0 +1,36 @@
FROM docker-base
## Pre-install the fundamental packages
RUN apt-get update && apt-get -y install \
sudo
COPY deps /deps
RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; \
dpkg_apt /deps/vasclnt_*.deb && \
dpkg_apt /deps/vasgp_*.deb
## Clean up
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /deps
## Expose to host, ie. image content will copy to host when container started
## For .so
VOLUME /host/lib/x86_64-linux-gnu
## For config
VOLUME /etc/pam.d/
VOLUME /host/etc
## For domain socket and local caches
VOLUME /var/opt/quest/vas/vasd/
## For home directory
VOLUME /home/
## Delete the symlinks and create full copies to host folder
ENTRYPOINT service rsyslog start \
&& cp --remove-destination /opt/quest/lib64/nss/libnss_vas4.so.2 \
/host/lib/x86_64-linux-gnu/ \
&& cp --remove-destination /opt/quest/lib64/security/pam_vas3.so \
/host/lib/x86_64-linux-gnu/security/ \
&& cp --remove-destination /etc/nsswitch.conf \
/host/etc/ \
&& service vasd start \
&& /bin/bash

View File

@ -0,0 +1,3 @@
APT::Install-Recommends "false";
APT::AutoRemove::RecommendsImportant "false";
APT::AutoRemove::SuggestsImportant "false";

View File

@ -0,0 +1,63 @@
# set classless routes based on the format specified in RFC3442
# e.g.:
# new_rfc3442_classless_static_routes='24 192 168 10 192 168 1 1 8 10 10 17 66 41'
# specifies the routes:
# 192.168.10.0/24 via 192.168.1.1
# 10.0.0.0/8 via 10.10.17.66.41
RUN="yes"
if [ "$RUN" = "yes" ]; then
if [ -n "$new_rfc3442_classless_static_routes" ]; then
if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
set -- $new_rfc3442_classless_static_routes
while [ $# -gt 0 ]; do
net_length=$1
via_arg=''
case $net_length in
32|31|30|29|28|27|26|25)
net_address="${2}.${3}.${4}.${5}"
gateway="${6}.${7}.${8}.${9}"
shift 9
;;
24|23|22|21|20|19|18|17)
net_address="${2}.${3}.${4}.0"
gateway="${5}.${6}.${7}.${8}"
shift 8
;;
16|15|14|13|12|11|10|9)
net_address="${2}.${3}.0.0"
gateway="${4}.${5}.${6}.${7}"
shift 7
;;
8|7|6|5|4|3|2|1)
net_address="${2}.0.0.0"
gateway="${3}.${4}.${5}.${6}"
shift 6
;;
0) # default route
net_address="0.0.0.0"
gateway="${2}.${3}.${4}.${5}"
shift 5
;;
*) # error
return 1
;;
esac
# take care of link-local routes
if [ "${gateway}" != '0.0.0.0' ]; then
via_arg="via ${gateway}"
fi
# set route (ip detects host routes automatically)
ip -4 route add "${net_address}/${net_length}" \
${via_arg} dev "${interface}" table default >/dev/null 2>&1
done
fi
fi
fi

View File

@ -1,8 +0,0 @@
deb http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie main contrib non-free
deb http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb-src http://httpredir.debian.org/debian jessie-updates main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free