Skip to content

(chore) Remove docker installation ++#7173

Merged
awesomenix merged 1 commit intomasterfrom
nishp/remove_docker
Oct 14, 2025
Merged

(chore) Remove docker installation ++#7173
awesomenix merged 1 commit intomasterfrom
nishp/remove_docker

Conversation

@awesomenix
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind cleanup
/kind deprecation

What this PR does / why we need it:

Docker and dockershim were removed from Kubernetes in version 1.24. This change removes all Docker-related installation, configuration, and runtime code from AgentBaker, as containerd is now the only supported container runtime.

aks-node-controller/helpers/utils.go

  • Removed conditional logic for dockerShim flag removal
  • Now unconditionally removes dockerShim flags since Docker is no longer supported
  • Flags removed: --cni-bin-dir, --cni-cache-dir, --cni-conf-dir, --docker-endpoint, --image-pull-progress-deadline, --network-plugin, --network-plugin-mtu

pkg/agent/baker.go

  • Applied same unconditional dockerShim flag removal in ValidateAndSetLinuxNodeBootstrappingConfiguration()
  • Removed unused profile variable after eliminating containerd runtime check
  • Removed template functions: IsDockerContainerRuntime and RequiresDocker
  • Added comments explaining Docker removal in Kubernetes 1.24

parts/linux/cloud-init/artifacts/cse_config.sh

  • Removed ensureDocker() function (lines 414-432)
  • Function was responsible for starting Docker service and configuring daemon.json

parts/linux/cloud-init/artifacts/cse_main.sh

  • Removed conditional Docker/containerd runtime selection
  • Now always calls ensureContainerd since it's the only supported runtime
  • Removed Docker login logic for private registry authentication
  • Private registry auth is now handled through containerd configuration

parts/linux/cloud-init/artifacts/cse_cmd.sh

  • Removed NEEDS_DOCKER_LOGIN template variable
  • Variable was used to determine if Docker login was needed for private registries

parts/linux/cloud-init/artifacts/cse_install.sh

  • Removed call to installMoby() in installContainerRuntime()
  • Added shellcheck directive for cleanupImagesRun() function (unrelated fix)

pkg/agent/datamodel/types.go

  • NeedsContainerd() method already updated to always return true
  • RequiresDocker() method already deprecated and always returns false
  • Both methods kept for backwards compatibility with clear deprecation comments

pkg/agent/datamodel/types_test.go

  • Updated TestHasContainerd to expect true for all runtime configurations

  • Updated test cases for Docker, empty string, and unexpected runtime values

  • Updated TestKubernetesConfig_RequiresDocker to expect false for all cases

  • Added explanatory comments about Kubernetes 1.24 Docker removal

  • Regenerated all snapshot test data via make generate

  • All Go tests pass successfully with new Docker-removed logic

The following kubelet flags were part of dockershim and are no longer valid:

  • --cni-bin-dir: CNI binary directory

  • --cni-cache-dir: CNI cache directory

  • --cni-conf-dir: CNI configuration directory

  • --docker-endpoint: Docker endpoint socket

  • --image-pull-progress-deadline: Image pull progress deadline

  • --network-plugin: Network plugin type

  • --network-plugin-mtu: Network plugin MTU

  • Before: Conditional logic checked ContainerRuntime config to decide between Docker and containerd

  • After: Containerd is always used as the container runtime

  • Private Registry Auth: Moved from docker login to containerd registry configuration

The following Docker/Moby-related code remains but is no longer called:

  • installMoby() function in parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
  • removeMoby() function in parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh
  • ensureRunc() function still exists (used by containerd)

These can be removed in a follow-up cleanup PR if desired.

This change:

  • Simplifies the codebase by removing Docker-specific logic
  • Aligns with Kubernetes 1.24+ which only supports containerd (and CRI-compatible runtimes)
  • Reduces maintenance burden by removing deprecated code paths
  • Has no functional impact on AKS nodes as Docker has not been supported since Kubernetes 1.24

Which issue(s) this PR fixes:

Fixes #

Requirements:

  • uses conventional commit messages
  • includes documentation
  • adds unit tests
  • tested upgrade from previous version
  • commits are GPG signed and Github marks them as verified

Special notes for your reviewer:

This removes support for Docker runtime configurations. All clusters must use containerd (which has been the default and only supported runtime since Kubernetes 1.24).

Release note:

none

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 10, 2025

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedOct 14, 2025, 4:31 PM

@awesomenix
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@awesomenix awesomenix force-pushed the nishp/remove_docker branch 2 times, most recently from 117e455 to 111b749 Compare October 10, 2025 20:17
@awesomenix awesomenix force-pushed the nishp/remove_docker branch 2 times, most recently from 1fdce0b to fa01ba4 Compare October 13, 2025 18:22
@awesomenix awesomenix marked this pull request as ready for review October 13, 2025 22:02
@awesomenix
Copy link
Copy Markdown
Contributor Author

… 1.24. This change removes all Docker-related installation, configuration, and runtime code from AgentBaker, as containerd is now the only supported container runtime.

**aks-node-controller/helpers/utils.go**
- Removed conditional logic for dockerShim flag removal
- Now unconditionally removes dockerShim flags since Docker is no longer supported
- Flags removed: `--cni-bin-dir`, `--cni-cache-dir`, `--cni-conf-dir`, `--docker-endpoint`, `--image-pull-progress-deadline`, `--network-plugin`, `--network-plugin-mtu`

**pkg/agent/baker.go**
- Applied same unconditional dockerShim flag removal in `ValidateAndSetLinuxNodeBootstrappingConfiguration()`
- Removed unused `profile` variable after eliminating containerd runtime check
- Removed template functions: `IsDockerContainerRuntime` and `RequiresDocker`
- Added comments explaining Docker removal in Kubernetes 1.24

**parts/linux/cloud-init/artifacts/cse_config.sh**
- Removed `ensureDocker()` function (lines 414-432)
- Function was responsible for starting Docker service and configuring daemon.json

**parts/linux/cloud-init/artifacts/cse_main.sh**
- Removed conditional Docker/containerd runtime selection
- Now always calls `ensureContainerd` since it's the only supported runtime
- Removed Docker login logic for private registry authentication
- Private registry auth is now handled through containerd configuration

**parts/linux/cloud-init/artifacts/cse_cmd.sh**
- Removed `NEEDS_DOCKER_LOGIN` template variable
- Variable was used to determine if Docker login was needed for private registries

**parts/linux/cloud-init/artifacts/cse_install.sh**
- Removed call to `installMoby()` in `installContainerRuntime()`
- Added shellcheck directive for `cleanupImagesRun()` function (unrelated fix)

**pkg/agent/datamodel/types.go**
- `NeedsContainerd()` method already updated to always return `true`
- `RequiresDocker()` method already deprecated and always returns `false`
- Both methods kept for backwards compatibility with clear deprecation comments

**pkg/agent/datamodel/types_test.go**
- Updated `TestHasContainerd` to expect `true` for all runtime configurations
- Updated test cases for Docker, empty string, and unexpected runtime values
- Updated `TestKubernetesConfig_RequiresDocker` to expect `false` for all cases
- Added explanatory comments about Kubernetes 1.24 Docker removal

- Regenerated all snapshot test data via `make generate`
- All Go tests pass successfully with new Docker-removed logic

The following kubelet flags were part of dockershim and are no longer valid:
- `--cni-bin-dir`: CNI binary directory
- `--cni-cache-dir`: CNI cache directory
- `--cni-conf-dir`: CNI configuration directory
- `--docker-endpoint`: Docker endpoint socket
- `--image-pull-progress-deadline`: Image pull progress deadline
- `--network-plugin`: Network plugin type
- `--network-plugin-mtu`: Network plugin MTU

- **Before**: Conditional logic checked `ContainerRuntime` config to decide between Docker and containerd
- **After**: Containerd is always used as the container runtime
- **Private Registry Auth**: Moved from `docker login` to containerd registry configuration

The following Docker/Moby-related code remains but is no longer called:
- `installMoby()` function in `parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh`
- `removeMoby()` function in `parts/linux/cloud-init/artifacts/ubuntu/cse_install_ubuntu.sh`
- `ensureRunc()` function still exists (used by containerd)

These can be removed in a follow-up cleanup PR if desired.

- ✅ All Go unit tests pass
- ✅ Datamodel tests updated and passing
- ✅ Test data regenerated successfully
- ✅ Shellcheck validation passes (warnings are pre-existing style issues unrelated to this change)

- Kubernetes 1.24 removed dockershim: https://kubernetes.io/blog/2022/05/03/dockershim-historical-context/
- Docker/containerd migration: https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/

This change:
- Simplifies the codebase by removing Docker-specific logic
- Aligns with Kubernetes 1.24+ which only supports containerd (and CRI-compatible runtimes)
- Reduces maintenance burden by removing deprecated code paths
- Has no functional impact on AKS nodes as Docker has not been supported since Kubernetes 1.24

---

**Breaking Change**: This removes support for Docker runtime configurations. All clusters must use containerd (which has been the default and only supported runtime since Kubernetes 1.24).
@awesomenix awesomenix merged commit 42a3019 into master Oct 14, 2025
39 of 40 checks passed
@awesomenix awesomenix deleted the nishp/remove_docker branch October 14, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants