Project Structure & Architecture - docker/cli

The project structure of the Docker CLI is organized in a way that separates different functionalities into various directories and files. Here’s a breakdown of the project structure:

Top-level directories

  • .github/: Contains GitHub-related configuration files such as issue templates, workflows, CODEOWNERS, etc.
  • cli/: Contains the main codebase for the Docker CLI.
  • cli-plugins/: Contains the plugin system for the Docker CLI.
  • cmd/: Contains the main command-line entry points for the Docker CLI.
  • contrib/: Contains various contribution-related files such as completions for different shells.
  • dockerfiles/: Contains Dockerfiles for building various components of the Docker CLI.
  • e2e/: Contains end-to-end test suites for the Docker CLI.
  • experimental/: Contains experimental features for the Docker CLI.
  • hack/: Contains various scripts and configuration files for hacking on the Docker CLI.
  • internal/: Contains internal implementation details of the Docker CLI.
  • man/: Contains man pages for the Docker CLI.
  • opts/: Contains various options and flags used throughout the Docker CLI.
  • pkg/: Contains reusable packages used throughout the Docker CLI.
  • scripts/: Contains various scripts used in the development and build process of the Docker CLI.
  • service/: Contains various services used in the Docker CLI.
  • templates/: Contains various templates used in the Docker CLI.

cli/ directory

The cli/ directory contains the main codebase for the Docker CLI. It is further divided into the following directories:

  • command/: Contains various commands that can be executed using the Docker CLI.
  • compose/: Contains various files related to Docker Compose.
  • connhelper/: Contains various connection helpers used in the Docker CLI.
  • context/: Contains various context-related functionalities used in the Docker CLI.
  • debug/: Contains various debugging tools used in the Docker CLI.
  • flags/: Contains various flags used throughout the Docker CLI.
  • hints/: Contains various hints used in the Docker CLI.
  • internal/: Contains internal implementation details of the Docker CLI.
  • manifest/: Contains various files related to Docker Manifest.
  • registry/: Contains various files related to Docker Registry.
  • streams/: Contains various stream-related functionalities used in the Docker CLI.
  • trust/: Contains various trust-related functionalities used in the Docker CLI.
  • version/: Contains various version-related functionalities used in the Docker CLI.
  • winresources/: Contains various Windows-related resources used in the Docker CLI.

cli-plugins/ directory

The cli-plugins/ directory contains the plugin system for the Docker CLI. It is further divided into the following directories:

  • examples/: Contains various example plugins for the Docker CLI.
  • hooks/: Contains various hooks used in the Docker CLI plugin system.
  • manager/: Contains the main plugin manager for the Docker CLI.
  • plugin/: Contains various plugin-related functionalities used in the Docker CLI.
  • socket/: Contains various socket-related functionalities used in the Docker CLI plugin system.

cmd/ directory

The cmd/ directory contains the main command-line entry points for the Docker CLI. It is further divided into the following directories:

  • docker/: Contains the main command-line entry point for the Docker CLI.
  • docker/internal/: Contains internal implementation details of the Docker CLI command-line entry point.
  • docker/winresources/: Contains various Windows-related resources used in the Docker CLI command-line entry point.

contrib/ directory

The contrib/ directory contains various contribution-related files such as completions for different shells. It is further divided into the following directories:

  • completion/: Contains various completion scripts for different shells.
  • bash/: Contains the Bash completion script for the Docker CLI.
  • fish/: Contains the Fish completion script for the Docker CLI.
  • powershell/: Contains the PowerShell completion script for the Docker CLI.
  • zsh/: Contains the Zsh completion script for the Docker CLI.

dockerfiles/ directory

The dockerfiles/ directory contains Dockerfiles for building various components of the Docker CLI. It is further divided into the following directories:

  • Dockerfile.authors: Contains the Dockerfile for building the Docker CLI authors image.
  • Dockerfile.dev: Contains the Dockerfile for building the Docker CLI development image.
  • Dockerfile.lint: Contains the Dockerfile for building the Docker CLI lint image.
  • Dockerfile.shellcheck: Contains the Dockerfile for building the Docker CLI shellcheck image.
  • Dockerfile.vendor: Contains the Dockerfile for building the Docker CLI vendor image.

e2e/ directory

The e2e/ directory contains end-to-end test suites for the Docker CLI. It is further divided into the following directories:

  • cli-plugins/: Contains various end-to-end test suites for the Docker CLI plugin system.
  • plugins/: Contains various end-to-end test suites for the Docker CLI plugins.
  • testdata/: Contains various test data used in the Docker CLI end-to-end test suites.

experimental/ directory

The experimental/ directory contains experimental features for the Docker CLI. It is further divided into the following directories:

  • README.md: Contains the README file for the experimental features of the Docker CLI.

hack/ directory

The hack/ directory contains various scripts and configuration files for hacking on the Docker CLI. It is further divided into the following directories:

  • otel/: Contains various OpenTelemetry-related scripts and configuration files.
  • otel/compose.yaml: Contains the Docker Compose file for the OpenTelemetry setup.
  • otel/otelcol.yaml: Contains the OpenTelemetry Collector configuration file.
  • otel/prom.yaml: Contains the Prometheus configuration file.

internal/ directory

The internal/ directory contains internal implementation details of the Docker CLI. It is further divided into the following directories:

  • test/: Contains various test suites for the Docker CLI.
  • test/builders/: Contains various builder-related test suites for the Docker CLI.
  • test/environment/: Contains various environment-related test suites for the Docker CLI.
  • test/network/: Contains various network-related test suites for the Docker CLI.
  • test/notary/: Contains various notary-related test suites for the Docker CLI.
  • test/output/: Contains various output-related test suites for the Docker CLI.
  • test/cli.go: Contains the main test suite for the Docker CLI.
  • test/cmd.go: Contains various command-related test suites for the Docker CLI.
  • test/doc.go: Contains various documentation-related test suites for the Docker CLI.
  • test/store.go: Contains various store-related test suites for the Docker CLI.
  • test/strings.go: Contains various string-related test suites for the Docker CLI.
  • test/writer.go: Contains various writer-related test suites for the Docker CLI.

man/ directory

The man/ directory contains man pages for the Docker CLI. It is further divided into the following directories