Containers. Pablo F. Ordóñez. October 18, 2018

Similar documents
An introduction to Docker

Singularity: container formats

Docker & why we should use it

How to run NoMachine server inside Docker

DGX-1 DOCKER USER GUIDE Josh Park Senior Solutions Architect Contents created by Jack Han Solutions Architect

Cross platform enablement for the yocto project with containers. ELC 2017 Randy Witt Intel Open Source Technology Center

Introduction to Linux

Anaconda Python Distribution

docker & HEP: containerization of applications for development, distribution and preservation

Arup Nanda VP, Data Services Priceline.com

Introduction to containers

Travis Cardwell Technical Meeting

Introduction to Linux

swiftenv Documentation

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Introduction to Containers

Optimizing Docker Images

Index. Bessel function, 51 Big data, 1. Cloud-based version-control system, 226 Containerization, 30 application, 32 virtualize processes, 30 31

MAKING CONTAINERS EASIER WITH HPC CONTAINER MAKER. Scott McMillan September 2018

Network softwarization Lab session 2: OS Virtualization Networking

KNIME Python Integration Installation Guide. KNIME AG, Zurich, Switzerland Version 3.7 (last updated on )

Be smart. Think open source.

FEniCS Containers Documentation

Dockerfile Best Practices

Investigating Containers for Future Services and User Application Support

Container-based virtualization: Docker

Homework 01 : Deep learning Tutorial

Docker und IBM Digital Experience in Docker Container

Implementing DPDK based Application Container Framework with SPP YASUFUMI OGAWA, NTT

DEPLOYMENT MADE EASY!

Platform Migrator Technical Report TR

Technical Manual(TM)

Engineering Robust Server Software

Introduction to UNIX I: Command Line 1 / 21

Preparing Your Google Cloud VM for W4705

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Red Hat Containers Cheat Sheet

Docker Cheat Sheet. Introduction

Support for Vanilla Universe Checkpointing. Thomas Downes University of Wisconsin-Milwaukee (LIGO)

Introduction to Linux

GNU/Linux 101. Casey McLaughlin. Research Computing Center Spring Workshop Series 2018

USING NGC WITH GOOGLE CLOUD PLATFORM

Linux Systems Administration Getting Started with Linux

Linux Essentials Objectives Topics:

Neural Network Compiler BNN Scripts User Guide

Dockerfile & docker CLI Cheat Sheet

CS234 Azure Step-by-Step Setup

Chris Calloway for Triangle Python Users Group at Caktus Group December 14, 2017

Introduction to remote command line Linux. Research Computing Team University of Birmingham

Guillimin HPC Users Meeting December 14, 2017

INTRODUCTION TO LINUX

Zephyr Kernel Installation & Setup Manual

INFRASTRUCTURE AS CODE

Deploying Rails with Kubernetes

Bash, In A NutShell RUSTY MYERS - SYSTEMS ADMINISTRATOR, PENN STATE CHRIS LAWSON - IT CONSULTANT/SUPPORT SPECIALIST, PENN STATE ALTOONA

The TinyHPC Cluster. Mukarram Ahmad. Abstract

Outline. Cgroup hierarchies

USING DOCKER FOR MXCUBE DEVELOPMENT AT MAX IV

LING 408/508: Computational Techniques for Linguists. Lecture 5

Getting Started With Containers

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Cloud Computing with APL. Morten Kromberg, CXO, Dyalog

Intel Distribution for Python* 2018 Beta

How to set Caffe up and running SegNet from scratch in OSX El Capitan using CPU mode

Outline. Cgroup hierarchies

Lec 1 add-on: Linux Intro

GPU Cluster Usage Tutorial

Scientific Filesystem. Vanessa Sochat

Linux. An introduction. Aurélien Villani 01/2018

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Infrastructure Security 2.0

CONTAINERIZING JOBS ON THE ACCRE CLUSTER WITH SINGULARITY

NGC CONTAINER. DU _v02 November User Guide

Andrej Filipčič

The Unix Shell & Shell Scripts

MYR-2017 SimulATOR user manual

Docker A FRAMEWORK FOR DATA INTENSIVE COMPUTING

Who is Docker and how he can help us? Heino Talvik

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

3/8/2017. Unix/Linux Introduction. In this part, we introduce. What does an OS do? Examples

Introduction of Linux

Rover Documentation Tracing with Perf, Conversion to CTF, and analysis with TraceCompass

Linux for Beginners. Windows users should download putty or bitvise:

Php Scripts If Then Else Linux Bash Shell

UNIX System Programming Lecture 3: BASH Programming

Manual Shell Script Linux If Not Exist Directory Does

Perl and R Scripting for Biologists

Recap From Last Time:

Remote Workflow Enactment using Docker and the Generic Execution Framework in EUDAT

Blockchain on Kubernetes

Code: Slides:

BGGN 213 Working with UNIX Barry Grant

Docker 101 Workshop. Eric Smalling - Solution Architect, Docker

Introduction to Python. Didzis Gosko

Introduction To. Barry Grant

Big Data Exercises. Fall 2016 Week 0 ETH Zurich

Transcription:

Containers Pablo F. Ordóñez October 18, 2018 1 Welcome Song: Sola vaya Interpreter: La Sonora Ponceña 2 Goals Containers!= ( Moby-Dick ) Containers are part of the Linux Kernel Make your own container 3 Cgroups tutorial 3.1 Set Server 3.2 Containers Wave Service provision Virtualization Example First Physical boxes Second Virtual machines Hardware VBox VMw KVM Third Containers OS Docker LXD Lxc 3.3 Control Groups Control groups (cgroups) is a kernel feature that limits, accounts for and isolates the CPU, memory, disk I/O and network s usage of one or more processes. The cgroups frameworks provides the following: 3.4 Install Resource limiting: a group can be configured not to exceed a specified memory limit or use more than the desired amount of processors or be limited to specific peripheral devices. Prioritization: one or more groups may be configured to utilize fewer or more CPUs or disk I/O throughput. Accounting: a group s resource usage is monitored and measured. Control: groups of processes can be frozen or stopped and restarted. sudo apt-get -y install cgroup-bin cgroup-lite cgroup-tools cgroupfs-mount libcgroup1 3.5 Testing script create a bash file in ~/bin rm ~/bin/testcgroups.sh touch ~/bin/testcgroups.sh chmod +x ~/bin/testcgroups.sh ll ~/bin/testcgroups.sh Create a mock bash script

echo " #!/bin/sh while [ 1 ]; do echo "hello world" sleep 5 done " > ~/bin/testcgroups.sh cat ~/bin/testcgroups.sh 3.6 The manual approach 3.6.1 create a cgroup named foo under the memory subsystem sudo mkdir /sys/fs/cgroup/memory/foo 3.6.2 Limit the memory for anything running under the cgroup foo to 50MB: echo 500000 sudo tee /sys/fs/cgroup/memory/foo/memory.limit_in_bytes sudo cat /sys/fs/cgroup/memory/foo/memory.limit_in_bytes 3.6.3 Testing Launch the app and monitoring Move the application to cgroup foo under the memory controller Verify that it s running within the desired cgroup sh ~/bin/testcgroups.sh & newpid=$! ps -U pordonez echo > $newpid /sys/fs/cgroup/memory/foo/cgroup.procs ps -o cgroup $newpid Terminate the process kill $newpid ps -U pordonez 4 Dockerfile tutorial Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. Each Dockerfile is a script, composed of various commands (instructions) and arguments listed successively to automatically perform actions on a base image in order to create (or form) a new one Dockerfiles begin with defining an image FROM which the build process starts. Followed by various other methods, commands and arguments (or conditions), in return, provide a new image which is to be used for creating docker containers. 4.1 Syntax Dockerfile syntax consists of two kind of main line blocks: comments and commands + arguments # Print "Hello docker!" RUN echo "Hello docker!" 4.2 Dockerfile Commands 4.2.1 ADD Copies the files from the source on the host into the container s own filesystem # Usage: ADD [source directory or URL] [destination directory] ADD /my_app_folder /docker_my_app_folder

4.2.2 RUN It takes a command as its argument and runs it to form the image It is used to build the image 4.2.3 CMD Similar to RUN It is not executed during build, but when a container is instantiated It should be considered as an initial, default command that gets executed (i.e. run) with the creation of containers based on the image. # Usage 1: CMD application "argument", "argument",.. CMD "echo" "Hello docker!" 4.2.4 ENTRYPOINT Set default application that is used every time a container is created 4.2.5 ENV Set the environment variables like dictionary (key:value) ENV PATH /opt/conda/bin:$path 4.2.6 EXPOSE Associate a specified port to enable networking between the running process inside the container and the outside world # Ipython Jupyter EXPOSE 8888 4.2.7 FROM It defines the base image to use to start the build process # Usage: FROM [image name] FROM ubuntu 4.2.8 WORKDIR Set where the command defined with CMD is to be executed. 4.3 Example 4.3.1 Create and empty Dockerfile cd ~/mydockerfiles pwd if [ -f "Dockerfile" ]; then rm Dockerfile; else touch Dockerfile; fi ll 4.3.2 Defining Our File and Its Purpose ############################################################ # Dockerfile to build Pytorch Jupyter container images # Based on Ubuntu ########################################################### " > Dockerfile

4.3.3 Setting The Base Image to Use FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04 cat Dockerfile 1. What s is the base image Dockerfile Cudnn Dockerfile Runtime Dockerfile Base 4.3.4 Defining The Maintainer (Author) # File Author / Maintainer MAINTAINER Example Ernesto Rafael 4.3.5 Metadata LABEL description="prebuilt jupyter environment" LABEL maintainer="https://github.com/erra/notebooks" 4.3.6 APP ARG PYTHON_VERSION=3.5 RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ bzip2 \ cmake \ git \ curl \ vim \ wget \ python3 \ python3-setuptools \ libhdf5-dev \ ca-certificates \ libjpeg-dev \ libpng-dev \ graphviz\ psmisc \ && apt-get -qq clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN wget https://repo.continuum.io/miniconda/miniconda3-latest-linux-x86_64.sh \ -O ~/miniconda.sh --quiet --no-check-certificate && \ chmod +x ~/miniconda.sh && \ ~/miniconda.sh -b -p /opt/conda && \ rm ~/miniconda.sh ENV PATH /opt/conda/bin:$path RUN /opt/conda/bin/conda install -y --quiet python=$python_version \ cython \ ipython \ pyyaml \ mkl \ mkl-include \

typing\ h5py \ jupyterlab \ matplotlib \ msgpack-python \ nltk \ numpy \ opencv \ pandas \ protobuf \ pytables \ scipy \ scikit-learn \ scikit-image \ && \ /opt/conda/bin/conda clean --yes --all --quiet RUN /opt/conda/bin/conda install -y --quiet pytorch torchvision -c pytorch && \ /opt/conda/bin/conda clean --yes --all --quiet RUN pip --no-cache-dir install -q --upgrade pip RUN pip --no-cache-dir install -q -U \ tensorflow-gpu \ tensorboardx \ visdom ## Set up our notebook config. COPY jupyter_notebook_config.py /root/.jupyter/ ## Jupyter has issues with being run directly: ## https://github.com/ipython/ipython/issues/7062 ## We just add a little wrapper script. COPY run_jupyter.sh / COPY ltb /usr/local/bin/ ## Tensorboard EXPOSE 6006 # IPython EXPOSE 8888 WORKDIR /notebooks CMD ["/run_jupyter.sh", "--allow-root"] 4.4 Build docker build -t cu91nnpytorch. 4.5 Run Jupyter nvidia-docker run -it -v ~/Documents/Developer/jupyter/:/notebooks -p 9999:8888 -p 6006:6006 cu91nnpytorch:latest Tensorboardx nvidia-docker run -it cu91nnpytorch:latest /bin/bash tbl Ipython

nvidia-docker run -it cu91nnpytorch:latest /bin/bash ipython