YumaPro Docker Developer Guide
Install Docker
Installation of the Docker environment is required on the host system to enable YumaPro Docker images. The links below provide Docker installation instructions for common platforms:
Linux - Install Docker Engine on Ubuntu (guides for other Linux systems are also available)
Windows - Install Docker Desktop on Windows
macOS - Install Docker Desktop on Mac
Build Image
Use the Dockerfile shown below:
# -----------------------------------------------------------------------------
# YumaPro SDK Docker (Dev container)
#
# Docs:
# Build: https://docs.yumaworks.com/en/latest/docker/yumapro-docker-dev.html
# Use : https://docs.yumaworks.com/en/latest/docker/yumapro-docker.html
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Build-time arguments
# -----------------------------------------------------------------------------
ARG UBUNTU_VERSION="latest"
FROM ubuntu:$UBUNTU_VERSION
ARG APP_USER="docker"
ARG APP_PASSWORD="changeme"
ARG HOME_DIR="/home/${APP_USER}"
ARG YUMAPRO_SDK_SOURCE
ARG YUMAPRO_SDK_DEST="${HOME_DIR}/yumapro-sdk"
ARG MAKE_FLAGS="EVERYTHING=1 USE_WERROR=1 DEBUG=1 DEBUG2=1\
WITH_PY_SIL=1\
WITH_YP_WEB=1\
WITH_GNMI=1\
WITH_GRPC=1\
WITH_SNMP=1"
ARG PY_SIL_VENV="${HOME_DIR}/py-sil-venv"
ARG YP_WEB_VENV="${HOME_DIR}/yp-web-venv"
ENV APP_USER=${APP_USER}
ENV DEBIAN_FRONTEND=noninteractive
# Validate required build args
RUN set -eux; \
if [ -z "${YUMAPRO_SDK_SOURCE:-}" ]; then \
echo "Error: YUMAPRO_SDK_SOURCE is not provided."; \
echo "Provide --build-arg YUMAPRO_SDK_SOURCE=<deb-or-source-dir>"; \
exit 1; \
fi
# -----------------------------------------------------------------------------
# System packages
# -----------------------------------------------------------------------------
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Core tools
ca-certificates sudo wget curl nano sshpass net-tools procps git \
# Build tools
cmake build-essential \
# Libraries
libxml2-dev libcbor-dev libssl-dev zlib1g-dev \
libncurses5-dev libcurl4-gnutls-dev libssh2-1-dev \
libfcgi-dev libzmq3-dev libsnmp-dev \
# Services
openssh-server apache2 libapache2-mod-fcgid \
# Python
python3 python3-venv python3-dev python3-pip; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# install Go
ARG GO_VERSION="latest"
RUN set -eux; \
if [ "${GO_VERSION}" = "latest" ]; then \
GO_VERSION="$(curl -fsSL 'https://go.dev/VERSION?m=text' | \
head -n 1)"; \
fi; \
ARCH="$(dpkg --print-architecture)"; \
case "$ARCH" in \
amd64) GOARCH=amd64 ;; \
arm64) GOARCH=arm64 ;; \
*) echo "Unsupported arch: $ARCH" >&2; exit 1 ;; \
esac; \
curl -fsSL "https://go.dev/dl/${GO_VERSION}.linux-${GOARCH}.tar.gz" \
-o /tmp/go.tgz; \
rm -rf /usr/local/go; \
tar -C /usr/local -xzf /tmp/go.tgz; \
rm /tmp/go.tgz; \
ln -sf /usr/local/go/bin/go /usr/local/bin/go; \
ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt;
# -----------------------------------------------------------------------------
# User
# -----------------------------------------------------------------------------
RUN set -eux; \
useradd -m -s /bin/bash "${APP_USER}"; \
echo "${APP_USER}:${APP_PASSWORD}" | chpasswd; \
adduser "${APP_USER}" sudo
# -----------------------------------------------------------------------------
# YumaPro SDK Installation (deb or source)
# -----------------------------------------------------------------------------
COPY $YUMAPRO_SDK_SOURCE "${YUMAPRO_SDK_DEST}/"
RUN set -eux; \
cd "${YUMAPRO_SDK_DEST}"; \
SRC_BASENAME="$(basename "${YUMAPRO_SDK_SOURCE}")"; \
if [ -f "./${SRC_BASENAME}" ] && \
[ "${SRC_BASENAME##*.}" = "deb" ]; then \
echo "true" > /tmp/is_deb_flag; \
elif [ -f "./Makefile" ]; then \
echo "false" > /tmp/is_deb_flag; \
else \
echo "Error: expected .deb or source tree with Makefile." >&2; \
exit 1; \
fi; \
chown -R "${APP_USER}:${APP_USER}" "${YUMAPRO_SDK_DEST}"
# yp-web tools-install
USER ${APP_USER}
RUN set -eux; \
python3 -m venv "${YP_WEB_VENV}"; \
"${YP_WEB_VENV}/bin/pip" install --no-cache-dir wheel; \
if [ -d "${YUMAPRO_SDK_DEST}/yp-web" ]; then \
cd "${YUMAPRO_SDK_DEST}/yp-web"; \
PATH="${YP_WEB_VENV}/bin:${PATH}" make tools-install; \
fi
USER root
# Install from .deb
RUN set -eux; \
cd "${YUMAPRO_SDK_DEST}"; \
IS_DEB="$(cat /tmp/is_deb_flag)"; \
if [ "$IS_DEB" = true ]; then \
SRC_BASENAME="$(basename "${YUMAPRO_SDK_SOURCE}")"; \
echo "Installing YumaPro SDK from .deb: ${SRC_BASENAME}"; \
apt-get update; \
apt-get install -y --no-install-recommends \
"./${SRC_BASENAME}"; \
rm -rf /var/lib/apt/lists/*; \
fi
# Build from source (non-root)
USER ${APP_USER}
RUN set -eux; \
cd "${YUMAPRO_SDK_DEST}"; \
IS_DEB="$(cat /tmp/is_deb_flag)"; \
if [ "$IS_DEB" = false ]; then \
echo "Building YumaPro SDK from source in ${YUMAPRO_SDK_DEST}"; \
make ${MAKE_FLAGS} distclean; \
make ${MAKE_FLAGS} clean; \
PATH="${YP_WEB_VENV}/bin:${PATH}" make ${MAKE_FLAGS}; \
fi
USER root
# Install from source (root)
RUN set -eux; \
cd "${YUMAPRO_SDK_DEST}"; \
IS_DEB="$(cat /tmp/is_deb_flag)"; \
if [ "$IS_DEB" = false ]; then \
echo "Installing YumaPro SDK from source code"; \
make install ${MAKE_FLAGS}; \
fi
# -----------------------------------------------------------------------------
# SSH Configuration
# -----------------------------------------------------------------------------
RUN set -eux; \
mkdir -p /var/run/sshd; \
grep -q '^Port 22$' /etc/ssh/sshd_config || echo 'Port 22' >> \
/etc/ssh/sshd_config; \
grep -q '^Port 830$' /etc/ssh/sshd_config || echo 'Port 830' >> \
/etc/ssh/sshd_config; \
grep -q '^Subsystem netconf ' /etc/ssh/sshd_config || \
echo 'Subsystem netconf /usr/sbin/netconf-subsystem-pro' >> \
/etc/ssh/sshd_config; \
sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' \
/etc/ssh/sshd_config; \
sed -i 's/^#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' \
/etc/ssh/sshd_config; \
ssh-keygen -A; \
mkdir -p "${HOME_DIR}/.ssh"; \
chown -R "${APP_USER}:${APP_USER}" "${HOME_DIR}/.ssh"; \
chmod 700 "${HOME_DIR}/.ssh"
# -----------------------------------------------------------------------------
# RESTCONF Configuration
# -----------------------------------------------------------------------------
RUN set -eux; \
IS_DEB="$(cat /tmp/is_deb_flag)"; \
if [ "$IS_DEB" = true ]; then \
mkdir -p /var/www/yang-api/; \
mv /usr/sbin/restconf /var/www/yang-api/; \
chmod 775 /var/www/yang-api/restconf; \
chown www-data:www-data /var/www/yang-api/restconf; \
fi; \
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.backup; \
a2enmod fcgid status headers; \
grep -q '^ExtendedStatus ' /etc/apache2/apache2.conf || \
echo 'ExtendedStatus On' >> /etc/apache2/apache2.conf; \
grep -q '^ServerName ' /etc/apache2/apache2.conf || \
echo 'ServerName localhost' >> /etc/apache2/apache2.conf; \
cp /usr/share/yumapro/util/restconf.conf /etc/apache2/sites-available/; \
a2ensite restconf.conf; \
a2dissite 000-default.conf || true
# -----------------------------------------------------------------------------
# PY-SIL Installation
# -----------------------------------------------------------------------------
USER ${APP_USER}
RUN set -eux; \
if [ -d /usr/share/yumapro/src/py-sil ]; then \
python3 -m venv "${PY_SIL_VENV}"; \
"${PY_SIL_VENV}/bin/pip" install --no-cache-dir wheel pyang; \
cp -R /usr/share/yumapro/src/py-sil "${HOME_DIR}/"; \
cd "${HOME_DIR}/py-sil/py-sil"; \
PATH="${PY_SIL_VENV}/bin:${PATH}" make install; \
cd "${HOME_DIR}/py-sil/py-sil-gen"; \
PATH="${PY_SIL_VENV}/bin:${PATH}" make install; \
fi
USER root
# -----------------------------------------------------------------------------
# YP-WEB Configuration
# -----------------------------------------------------------------------------
RUN set -eux; \
if [ -f /usr/share/yumapro/util/ypweb-apache2.conf ]; then \
a2enmod proxy proxy_http proxy_wstunnel; \
cp /usr/share/yumapro/util/ypweb-apache2.conf \
/etc/apache2/sites-available/yp-web.conf; \
a2ensite yp-web.conf; \
grep -q '^Listen 8080$' /etc/apache2/ports.conf || \
echo "Listen 8080" >> /etc/apache2/ports.conf; \
fi
# -----------------------------------------------------------------------------
# Container defaults
# -----------------------------------------------------------------------------
EXPOSE 22 80 830 8080
WORKDIR ${HOME_DIR}
CMD /usr/sbin/sshd -e && \
service apache2 restart && \
netconfd-pro --version && \
exec su - "${APP_USER}"
Prepare the build context:
Place the Dockerfile and the YumaPro SDK artifact in the same directory:
Binary installation: the SDK binary package (.deb)
Source installation: the SDK source tree directory
Note
YUMAPRO_SDK_SOURCE is required and must reference a path inside the Docker build context (the directory passed to 'docker build', usually '.'). Set it to the SDK binary package (.deb) or the SDK source tree directory. The Dockerfile detects the artifact type and installs accordingly.
Binary installation (SDK .deb package):
sudo docker build -t yumapro-sdk-eval-docker . --no-cache \
--build-arg YUMAPRO_SDK_SOURCE=yumapro-sdk-<SDK_VERSION>.u<UBUNTU_RELEASE>.<ARCH>.deb \
--build-arg UBUNTU_VERSION=<UBUNTU_VERSION>
Source installation (SDK source tree):
sudo docker build -t yumapro-sdk-docker . --no-cache \
--build-arg YUMAPRO_SDK_SOURCE=yumapro-sdk-source
Where:
'-t <image_tag>' sets the output image tag
'.' is the Docker build context directory (must contain the Dockerfile and the SDK artifact)
'YUMAPRO_SDK_SOURCE=...' points to the SDK artifact inside the build context (either the SDK .deb filename or the SDK source tree directory)
'UBUNTU_VERSION=...' selects the base Ubuntu tag (optional; default is 'latest')
Generic form:
sudo docker build -t <image_tag> . --no-cache \
--build-arg YUMAPRO_SDK_SOURCE=<sdk_artifact_path> \
--build-arg <other_dockerfile_build_arg>=<value>
Docker build arguments (defaults shown):
Only YUMAPRO_SDK_SOURCE is required.
APP_USER (default 'docker') and APP_PASSWORD (default 'changeme')
HOME_DIR (default '/home/<APP_USER>')
YUMAPRO_SDK_DEST (default '$HOME_DIR/yumapro-sdk')
MAKE_FLAGS passed to 'make' for source builds
PY_SIL_VENV, YP_WEB_VENV for virtualenv paths
UBUNTU_VERSION to select the base Ubuntu tag (default 'latest')
GO_VERSION to select the Go version (default 'latest')
The default 'MAKE_FLAGS' enables these features:
WITH_YP_WEB: Launching YP-WEB, YP-WEB UI on Docker (start 'yangcli-gw' first, then 'yp-web-core'), and YP-WEB User Manual
Run Image
Start a container:
Run the image built in the previous steps. Use the image tag selected at build time (for example, 'yumapro-sdk-eval-docker' or 'yumapro-sdk-docker').
sudo docker run -it --name yumapro-sdk \
yumapro-sdk-docker
Where:
'--name yumapro-sdk' sets the container name (used in the examples below)
'yumapro-sdk-docker' is the image tag to run
Generic form:
sudo docker run -it --name <container_name> \
<image>
Service ports (container ports):
830: NETCONF over SSH
80: RESTCONF via Apache
8080: YP-WEB UI
22: SSH
Container IP address (Linux bridge networking):
sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' yumapro-sdk
Example output:
172.17.0.2
Alternatively, use 'ifconfig' inside the container to confirm the IP address:
ifconfig
Example output (eth0 and lo shown):
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
Example endpoints (replace <container_ip>; example uses 172.17.0.2):
RESTCONF: http://<container_ip>/restconf/data (example: http://172.17.0.2/restconf/data)
YP-WEB: http://<container_ip>:8080/ (example: http://172.17.0.2:8080/)
NETCONF (yangcli-pro):
yangcli-pro server=<container_ip> user=docker password=changeme
The container starts sshd and Apache and then drops into the configured application user (default user/password: 'docker' / 'changeme').
Refer to the YumaPro Docker User Guide for usage details.