Yum Install Docker

Posted : admin On 13.08.2021

Let’s Install Docker on EC2 Instance. In this tutorial, we will use Amazon Linux to install docker. Amazon Linux/Amazon Linux2 is the Linux Operating System used in EC2 Instance. Step 1– Log to Linux EC2 Instance and update it. $ sudo yum update -y. Step 2– Install docker using Yum command $ sudo yum install docker -y.

This tutorial explains, how to install docker on EC2 Instance. Before starting, let’s have some brief knowledge about Docker.

Docker is a platform that combines applications and its dependencies in the form of packages, called container. We can run multiple containers on a single Operating System. Containers are not Virtual Machines. Virtual Machines requires Operating System to run applications, but containers do not. As containers don’t need an Operating System, it takes very little time to start and hence it is very faster than Virtual Machines.

Also Learn: How to install Ansible on Amazon Linux(EC2 )

  1. Docker is a technology that provides the tools for you to build, run, test, and deploy distributed applications that are based on Linux containers. Amazon ECS uses Docker images in task definitions to launch containers as part of tasks in your clusters.
  2. How to install and use Docker on RHEL 7 or CentOS 7 (method 1) The procedure to install Docker is as follows: Open the terminal application or login to the remote box using ssh command: ssh [email protected]; Type the following command to install Docker via yum provided by Red Hat: sudo yum install docker.
  3. Finally install Docker CE by running the command below in your terminal. Sudo yum install docker-ce. If you get dependency issues with Podman allow errasing. Sudo yum install docker-ce -allowerasing. Agree to install by hitting the y key in your keyboard.

and Launching Amazon Linux EC2 Instance

Let’s Install Docker on EC2 Instance

In this tutorial, we will use Amazon Linux to install docker. Amazon Linux/Amazon Linux2 is the Linux Operating System used in EC2 Instance.

Step 1– Log to Linux EC2 Instance and update it.

$ sudo yum update -y

Step 2– Install docker using Yum command

$ sudo yum install docker -y

Step 3– Start Docker Service

$ Service docker start

Step 4– Check docker Version.

$ docker -v

Basic Configuration (Creating Docker File / Running Docker Image)

After you install docker on ec2 , let’s have some basic setup for Docker.

Step 1 – Create a docker file

Dockerfile is a text file where we write instructions to build an image.

Create a folder name Images on the Amazon Linux box.

$ mkdir images

Move to folder images

$ cd images

Create a file name Dockerfile inside images folder

$ nano Dockerfile

Put the content in the following way inside the Dockerfile.

FROM Ubuntu ( It will use the Official image Ubuntu to build your image)

MAINTAINER chandan <[email protected]>

( It sets the Author field of the generated image)

RUN apt-get update ( It will update the image at the time of Build)

CMD [ “echo”, ” Hello World ……….! “] ( It will run echo command when we run the docker container image)

Please also readHow to install docker on ec2 Instance(Windows)

You may also likeInstall Docker on Ubuntu using Script

Step 2– Run the docker build command to build the image.

$ docker build .

Note : ( . command is used when you are inside images folder where Dockerfile is present, alternatively you can put the docker file absolute path like /home/ec2-user/images/Dockerfile)

You can run the following command as well to Name and tag your Image. Here myimage is the Name and 01 is Tag of the image.

$ docker build -t myimage:01 .

Step 3– See the Docker Images after build

$ docker images

Step 4 – Run the docker image

$ docker run 07deaa33585e

Here 07deaa33585e is the IMAGE ID that can be seen in docker images command.

You can see here, it executed the echo command as soon as we run the docker image. In the same way, we can run any script, commands or any application by running a docker image.

Click to tweet this tip !

I hope you enjoyed this tutorial and learned to install docker on ec2 instance (Amazon Linux). If you think this is really helpful, please do share this with others as well. Please also share your valuable feedback, comment or any query in the comment box. I will really happy to resolve your all queries anytime.

Thank You

If you think we helped you or just want to support us, please consider these:-

Connect to us: FacebookTwitter

The Intel® Distribution of OpenVINO™ toolkit quickly deploys applications and solutions that emulate human vision. Based on Convolutional Neural Networks (CNN), the toolkit extends computer vision (CV) workloads across Intel® hardware, maximizing performance. The Intel® Distribution of OpenVINO™ toolkit includes the Intel® Deep Learning Deployment Toolkit.

This guide provides the steps for creating a Docker* image with Intel® Distribution of OpenVINO™ toolkit for Linux* and further installation.

System Requirements

Target Operating Systems

Morberplz ig

  • Ubuntu* 18.04 long-term support (LTS), 64-bit
  • Ubuntu* 20.04 long-term support (LTS), 64-bit
  • CentOS* 7.6
  • Red Hat* Enterprise Linux* 8.2 (64 bit)

Host Operating Systems

  • Linux with installed GPU driver and with Linux kernel supported by GPU driver

Prebuilt images

Prebuilt images are available on:

Use Docker* Image for CPU

  • Kernel reports the same information for all containers as for native application, for example, CPU, memory information.
  • All instructions that are available to host process available for process in container, including, for example, AVX2, AVX512. No restrictions.
  • Docker* does not use virtualization or emulation. The process in Docker* is just a regular Linux process, but it is isolated from external world on kernel level. Performance penalty is small.

Build a Docker* Image for CPU

You can use available Dockerfiles or generate a Dockerfile with your setting via DockerHub CI Framework for Intel® Distribution of OpenVINO™ toolkit. The Framework can generate a Dockerfile, build, test, and deploy an image with the Intel® Distribution of OpenVINO™ toolkit.

Run the Docker* Image for CPU

Run the image with the following command:

Use a Docker* Image for GPU

Build a Docker* Image for GPU

Prerequisites:

  • GPU is not available in container by default, you must attach it to the container.
  • Kernel driver must be installed on the host.
  • Intel® OpenCL™ runtime package must be included into the container.
  • In the container, non-root user must be in the video and render groups. To add a user to the render group, follow the Configuration Guide for the Intel® Graphics Compute Runtime for OpenCL™ on Ubuntu* 20.04.

Before building a Docker* image on GPU, add the following commands to a Dockerfile:

Ubuntu 18.04/20.04:

RUN useradd -ms /bin/bash -G video,users openvino &&
RUN apt-get update &&
apt-get install -y --no-install-recommends ocl-icd-libopencl1 &&
curl -L 'https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-gmmlib_19.3.2_amd64.deb' --output 'intel-gmmlib_19.3.2_amd64.deb' &&
curl -L 'https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-igc-core_1.0.2597_amd64.deb' --output 'intel-igc-core_1.0.2597_amd64.deb' &&
curl -L 'https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-igc-opencl_1.0.2597_amd64.deb' --output 'intel-igc-opencl_1.0.2597_amd64.deb' &&

Yum Install Docker-compose

curl -L 'https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-opencl_19.41.14441_amd64.deb' --output 'intel-opencl_19.41.14441_amd64.deb' &&

Yum Install Docker Amazon Linux 2

curl -L 'https://github.com/intel/compute-runtime/releases/download/19.41.14441/intel-ocloc_19.41.14441_amd64.deb' --output 'intel-ocloc_19.04.12237_amd64.deb' &&
Yum
ldconfig &&

CentOS 7/RHEL 8:

RUN useradd -ms /bin/bash -G video,users openvino &&
RUN groupmod -g 44 video
RUN yum update -y && yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm &&
yum update -y && yum install -y ocl-icd ocl-icd-devel &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-19.3.2-1.el7.x86_64.rpm/download -o intel-gmmlib-19.3.2-1.el7.x86_64.rpm &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm/download -o intel-gmmlib-devel-19.3.2-1.el7.x86_64.rpm &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-core-1.0.2597-1.el7.x86_64.rpm/download -o intel-igc-core-1.0.2597-1.el7.x86_64.rpm &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm/download -o intel-igc-opencl-1.0.2597-1.el7.x86_64.rpm &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm/download -o intel-igc-opencl-devel-1.0.2597-1.el7.x86_64.rpm &&
curl -L https://sourceforge.net/projects/intel-compute-runtime/files/19.41.14441/centos-7/intel-opencl-19.41.14441-1.el7.x86_64.rpm/download -o intel-opencl-19.41.14441-1.el7.x86_64.rpm
ldconfig &&
yum remove -y epel-release

Run the Docker* Image for GPU

To make GPU available in the container, attach the GPU to the container using --device /dev/dri option and run the container:

docker run -it --rm --device /dev/dri <image_name>

NOTE: If your host system is Ubuntu 20, follow the Configuration Guide for the Intel® Graphics Compute Runtime for OpenCL™ on Ubuntu* 20.04.

Use a Docker* Image for Intel® Neural Compute Stick 2

Build and Run the Docker* Image for Intel® Neural Compute Stick 2

Known limitations:

  • Intel® Neural Compute Stick 2 device changes its VendorID and DeviceID during execution and each time looks for a host system as a brand new device. It means it cannot be mounted as usual.
  • UDEV events are not forwarded to the container by default it does not know about device reconnection.
  • Only one device per host is supported.

Use one of the following options as Possible solutions for Intel® Neural Compute Stick 2:

Option #1

  1. Get rid of UDEV by rebuilding libusb without UDEV support in the Docker* image (add the following commands to a Dockerfile):
    • Ubuntu 18.04/20.04:
      automake
      libtool
      udev'
      apt-get install -y --no-install-recommends ${BUILD_DEPENDENCIES} &&
      RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip &&
      RUN ./bootstrap.sh &&
      make -j4
      WORKDIR /opt/libusb-1.0.22/libusb
      /bin/bash ./libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' &&
      /bin/mkdir -p '/usr/local/include/libusb-1.0' &&
      /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' &&
      RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' &&
      cp /opt/intel/openvino_2021/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ &&
    • CentOS 7:
      automake
      unzip
      RUN yum update -y && yum install -y ${BUILD_DEPENDENCIES} &&
      yum clean all && rm -rf /var/cache/yum
      WORKDIR /opt
      RUN curl -L https://github.com/libusb/libusb/archive/v1.0.22.zip --output v1.0.22.zip &&
      RUN ./bootstrap.sh &&
      make -j4
      WORKDIR /opt/libusb-1.0.22/libusb
      /bin/bash ./libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' &&
      /bin/mkdir -p '/usr/local/include/libusb-1.0' &&
      /usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' &&
      printf 'nexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/libn' >> /opt/intel/openvino_2021/bin/setupvars.sh
      WORKDIR /opt/libusb-1.0.22/
      RUN /usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' &&
      cp /opt/intel/openvino_2021/deployment_tools/inference_engine/external/97-myriad-usbboot.rules /etc/udev/rules.d/ &&
  2. Run the Docker* image:
    docker run -it --rm --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb <image_name>

Option #2

Run container in the privileged mode, enable the Docker network configuration as host, and mount all devices to the container:

docker run -it --rm --privileged -v /dev:/dev --network=host <image_name>

NOTES:

  • It is not secure.
  • Conflicts with Kubernetes* and other tools that use orchestration and private networks may occur.

Use a Docker* Image for Intel® Vision Accelerator Design with Intel® Movidius™ VPUs

Build Docker* Image for Intel® Vision Accelerator Design with Intel® Movidius™ VPUs

To use the Docker container for inference on Intel® Vision Accelerator Design with Intel® Movidius™ VPUs:

  1. Set up the environment on the host machine, that is going to be used for running Docker*. It is required to execute hddldaemon, which is responsible for communication between the HDDL plugin and the board. To learn how to set up the environment (the OpenVINO package or HDDL package must be pre-installed), see Configuration guide for HDDL device or Configuration Guide for Intel® Vision Accelerator Design with Intel® Movidius™ VPUs.
  2. Prepare the Docker* image (add the following commands to a Dockerfile).
    • Ubuntu 18.04:
      RUN apt-get update &&
      libboost-filesystem1.65-dev
      libjson-c3 libxxf86vm-dev &&
    • Ubuntu 20.04:
      RUN apt-get update &&
      libboost-filesystem-dev
      libjson-c4
      rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*
    • CentOS 7:
      RUN yum update -y && yum install -y
      boost-thread
      boost-system
      boost-date-time
      boost-atomic
      libXxf86vm-devel &&
  3. Run hddldaemon on the host in a separate terminal session using the following command:

Yum Install Docker Ce

Run the Docker* Image for Intel® Vision Accelerator Design with Intel® Movidius™ VPUs

To run the built Docker* image for Intel® Vision Accelerator Design with Intel® Movidius™ VPUs, use the following command:

docker run -it --rm --device=/dev/ion:/dev/ion -v /var/tmp:/var/tmp <image_name>

NOTES:

  • The device /dev/ion need to be shared to be able to use ion buffers among the plugin, hddldaemon and the kernel.
  • Since separate inference tasks share the same HDDL service communication interface (the service creates mutexes and a socket file in /var/tmp), /var/tmp needs to be mounted and shared among them.

In some cases, the ion driver is not enabled (for example, due to a newer kernel version or iommu incompatibility). lsmod grep myd_ion returns empty output. To resolve, use the following command:

docker run -it --rm --net=host -v /var/tmp:/var/tmp –ipc=host <image_name>

NOTES:

  • When building docker images, create a user in the docker file that has the same UID and GID as the user which runs hddldaemon on the host.
  • Run the application in the docker with this user.
  • Alternatively, you can start hddldaemon with the root user on host, but this approach is not recommended.

Run Demos in the Docker* Image

To run the Security Barrier Camera Demo on a specific inference device, run the following commands with the root privileges (additional third-party dependencies will be installed):

CPU:

docker run -itu root:root --rm --device=/dev/ion:/dev/ion -v /var/tmp:/var/tmp --device /dev/dri:/dev/dri --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb <image_name>
/bin/bash -c 'apt update && apt install sudo && deployment_tools/demo/demo_security_barrier_camera.sh -d CPU -sample-options -no_show'

GPU:

docker run -itu root:root --rm --device=/dev/ion:/dev/ion -v /var/tmp:/var/tmp --device /dev/dri:/dev/dri --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb <image_name>
/bin/bash -c 'apt update && apt install sudo && deployment_tools/demo/demo_security_barrier_camera.sh -d GPU -sample-options -no_show'

MYRIAD:

docker run -itu root:root --rm --device=/dev/ion:/dev/ion -v /var/tmp:/var/tmp --device /dev/dri:/dev/dri --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb <image_name>
/bin/bash -c 'apt update && apt install sudo && deployment_tools/demo/demo_security_barrier_camera.sh -d MYRIAD -sample-options -no_show'

HDDL:

docker run -itu root:root --rm --device=/dev/ion:/dev/ion -v /var/tmp:/var/tmp --device /dev/dri:/dev/dri --device-cgroup-rule='c 189:* rmw' -v /dev/bus/usb:/dev/bus/usb <image_name>
/bin/bash -c 'apt update && apt install sudo && deployment_tools/demo/demo_security_barrier_camera.sh -d HDDL -sample-options -no_show'

Use a Docker* Image for FPGA

Intel will be transitioning to the next-generation programmable deep-learning solution based on FPGAs in order to increase the level of customization possible in FPGA deep-learning. As part of this transition, future standard releases (i.e., non-LTS releases) of Intel® Distribution of OpenVINO™ toolkit will no longer include the Intel® Vision Accelerator Design with an Intel® Arria® 10 FPGA and the Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA.

Intel® Distribution of OpenVINO™ toolkit 2020.3.X LTS release will continue to support Intel® Vision Accelerator Design with an Intel® Arria® 10 FPGA and the Intel® Programmable Acceleration Card with Intel® Arria® 10 GX FPGA. For questions about next-generation programmable deep-learning solutions based on FPGAs, please talk to your sales representative or contact us to get the latest FPGA updates.

For instructions for previous releases with FPGA Support, see documentation for the 2020.4 version or lower.

Troubleshooting

If you got proxy issues, please setup proxy settings for Docker. See the Proxy section in the Install the DL Workbench from Docker Hub* topic.

Additional Resources

  • DockerHub CI Framework for Intel® Distribution of OpenVINO™ toolkit. The Framework can generate a Dockerfile, build, test, and deploy an image with the Intel® Distribution of OpenVINO™ toolkit. You can reuse available Dockerfiles, add your layer and customize the image of OpenVINO™ for your needs.
  • Intel® Distribution of OpenVINO™ toolkit home page: https://software.intel.com/en-us/openvino-toolkit
  • OpenVINO™ toolkit documentation: https://docs.openvinotoolkit.org
  • Intel® Neural Compute Stick 2 Get Started: https://software.intel.com/en-us/neural-compute-stick/get-started
  • Intel® Distribution of OpenVINO™ toolkit Docker Hub* home page: https://hub.docker.com/u/openvino