Developer Guide

  • BETA
  • 04/06/2022
  • Public Content

Build containers from terminal

This section shows how to build containers manually from dockerfiles present in your DevCloud filesystem inside the JupyterLab interface. Containers built in your JupyterLab terminal session can then be pushed to your private registry associated with your DevCloud Container Playground account to test on various Intel Platforms.
See Import Code and Build Containers to import source code already hosted in a git repository with just a few clicks using the web user interface.

Navigate to CLI

Use the top navigation menu to access the
Coding Environment
to open the JupyterLab interface in a new browser tab. Use the
+
button from the JupyterLab file browser to open a
Terminal
from the Launcher.
If you not able to access the JupyterLab interface, make sure to
Allow Pop-ups
in your browser.

Build a Container

Use the JupyterLab terminal to build the container with
buildah
:
buildah bud --format docker -f DOCKERFILE_NAME.Dockerfile -t CONTAINER_NAME:CONTAINER_TAG .
The list of containers built from the JupyterLab interface can be viewed with the
buildah images
command. You can also run
buildah bud --format docker -t CONTAINER_NAME:CONTAINER_TAG .
inside the directory containing the file
.Dockerfile
.
You cannot run the built container inside the Jupyterlab interface. See the next section to first push the container to your devcloud private container registry as a resource and Test Containers.

Push to Private Registry

You must retag your container to begin with the private registry URL associated with your devcloud account. Use the environment variable
$REGISTRY_URL
to rename your container.
buildah tag CONTAINER_NAME:CONTAINER_TAG $REGISTRY_URL/CONTAINER_NAME:CONTAINER_TAG
To run and test the containers built in the JupyterLab interface inside a project in the container playground portal push your retagged container with the below command.
buildah push $REGISTRY_URL/CONTAINER_NAME:CONTAINER_TAG

Customize a Sample Application

Your devcloud storage filesystem includes the latest source code for the sample applications hosted on DevCloud Marketplace. Each sample includes detailed instructions on:
  • How it Works?
  • Supported Runtime Configurations
  • Build and Run commands on DevCloud Container Playground and your local system
The
View/Edit Code
option from the Marketplace opens up the readme for each sample in the JupyterLab environment. You can also visit the public repository:
Try building a simple container with below example:
  • Create and navigate inside a working directory:
    mkdir cli-example && cd cli-example
  • Write a dockerfile for a lightweight container that prints numbers:
    (echo FROM python:slim && echo 'ENTRYPOINT [ "seq", "30"]') > Dockerfile
  • Build the container while including private registry url:
    buildah bud --format docker -t $REGISTRY_URL/cli-example:latest
  • Push the container to assign a project and launch:
    buildah push $REGISTRY_URL/cli-example:latest

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.