Building Containers - moby/moby

The Moby Project is an open-source initiative introduced in 2017 by Docker to advance the software containerization movement. It serves as a library of components, a framework for assembling those components into custom container-based systems, and a platform for collaboration and experimentation in the container ecosystem. The project is designed for system builders who want to create their own container-based systems, offering a wide range of components that can be used as-is or replaced with custom solutions.

The main components of the Moby Project include:

  1. Moby Origin: A reference assembly that forms the basis for the Docker container platform, as well as examples of container systems using various components from the Moby library or from other projects.

  2. Library of containerized backend components: A collection of containerized components, such as low-level builders, logging facilities, volume management, networking, image management, containerd, SwarmKit, and more. These components can be used individually or combined to create custom container platforms.

  3. Framework for assembling components: A framework for assembling the components into a standalone container platform, along with tooling for building, testing, and deploying artifacts for these assemblies.

Examples of Moby components include:

  • containerd: A container runtime that provides core functionality for Docker and other container platforms.
  • libcontainer: A library for managing containers that predates containerd and is used by Docker and other projects.
  • runC: A CLI tool for spawning and running containers according to the OCI specification.
  • SwarmKit: A toolkit for orchestrating containers and services.
  • Notary: A tool for creating and managing trusted collections of content.

To build containers using Moby, you can use the BuildKit component, which is an alternative to the Docker build engine. BuildKit is designed for building container images more efficiently and with better performance than the traditional Docker build process. To use BuildKit, you can install Docker Buildx, a command-line tool that leverages BuildKit for building container images.

Here’s an example of using Docker Buildx to build a container image:

# Install Docker Buildx
docker buildx install

# Create a new builder instance using the latest builder version
docker buildx create --use

# Build the container image using the Dockerfile in the current directory
docker buildx build --platform linux/amd64 -t my-image:latest .

For more information on using BuildKit and Docker Buildx, refer to the following resources:

Sources: