Main Content

Get Started with Containers

What is a Container?

A container is an isolated unit of software that contains everything required to run a specific application, including code, libraries, dependencies, drivers and settings. Containers have several strengths, they are:

  • Consistent: Containers guarantee a consistent behavior regardless of where you deploy them. Since they package all the software dependencies necessary to run an application (including specific versions of runtimes and software libraries), containers run and produce the same output in any environment. Therefore, containers are ideal for running the same application in multiple environments. For example, you can use them to test your applications simultaneously, run multiple simulations, or to do reproducible research in different environments.

  • Portable: You can deploy containers in almost any operating system or platform. Containers can run on Linux®, Windows® and Mac operating systems and you can deploy them in a private data center, a public cloud (such as AWS® or Microsoft® Azure®) or in a local environment. This means that you can easily share a container image with your colleagues without worrying about software or platform dependencies.

  • Isolated, lightweight and efficient: Unlike a virtual machine, containers share part of the operating system (the kernel) of the host machine and multiple instances of the same container share common resources. This feature makes them lightweight and efficient, containerized applications can start in seconds. However, containers are isolated from each other and the host operating system. That is, they have read-only access to shared resources and can only change files inside the container itself. To extend functionality, you can mount additional files, folders, and devices into containers.

  • Virtualized: Containers virtualize the operating system including CPU, GPUs, memory and file system. Therefore, a containerized application thinks that it has access to a regular operating system. This means that you can use the same logic to program a containerized application that you would use for a regular application.

Using MATLAB with Containers

  • The main reason to dockerize MATLAB® is to integrate it with a Continuous Integration/Continuous Delivery (CI/CD) pipeline that is completely containerized. MATLAB has integrations with several CI platforms including CircleCI®, Jenkins®, and Travis CI. For more information, see Continuous Integration with MATLAB on CI Platforms (MATLAB).

  • Containers also allow you to take advantage of cloud computing resources. Cloud platforms have integrated container management workflows. Containers are often the easiest way to get software on your cloud of choice.

  • If your organization uses containers for most of their applications and services, you can also integrate a MATLAB application in a container with your existing business applications.

To learn more about running MATLAB in containers, see the video Running MATLAB in Docker Containers. For more information on licensing MATLAB in containers, see License Requirements for MATLAB on Cloud Platforms.

Tip

To get started with containers, you can start a container that includes MATLAB and all the software dependencies necessary to run it. For more information, see MATLAB Container on Docker Hub.

Explore MathWorks Container Offerings

Container OfferingFeaturesLinks
MATLAB Container Image on Docker® Hub
MATLAB Deep Learning Container Image on NVIDIA®
  • Contains the MATLAB toolboxes you need for deep learning, as well as a few pretrained neural nets.

  • Contains NVIDIA drivers, that allows you to use the image on NVIDIA's specialized hardware.

  • Size: about 10 gigabytes.

MATLAB Deep Learning Container Image on Docker Hub
  • Contains the MATLAB toolboxes you need for deep learning, as well as a few pretrained neural nets.

  • Size: about 10 gigabytes.

MATLAB Dockerfile on GitHub®
  • Use this Dockerfile to customize the MATLAB container image on Docker Hub. For example, the README file in the GitHub repository shows you how to install MATLAB toolboxes in the container image.

  • Less convenient than the prebuilt image on Docker Hub, which you can just pull and run.

Deploying MATLAB Applications in Containers
  • Package MATLAB applications in a Docker container using MATLAB Compiler SDK™.

  • As the resulting image uses MATLAB Runtime, rather than a full MATLAB, it has a much smaller size than that of a fully containerized MATLAB.

  • You need to rebuild the image to change the application.

Related Topics