build a Docker image that includes Kubernetes (kubectl) and the Azure CLI,

Lungu, Alexandru 0 Reputation points
2025-04-15T09:40:46.2166667+00:00

hi team, how to build a Docker image that includes Kubernetes (kubectl) and the Azure CLI?

Does Micorosft provide a generic image with k8s and azure cli included? thx

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
493 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anusree Nashetty 3,250 Reputation points Microsoft External Staff
    2025-04-15T17:32:39.03+00:00

    Hi Lungu, Alexandru,

    Microsoft does not currently provide a single official Docker image that includes both Azure CLI and kubectl pre-installed. Microsoft provides the base azure-cli image, which you can easily extend to include kubectl.

    Building a Docker image that includes both Kubernetes (kubectl) and the Azure CLI involves creating a Dockerfile that specifies the installation steps for these tools. Choose a base image that has the necessary dependencies. Add the commands to install kubectl and the Azure CLI. Combine all the steps into a Dockerfile and save it to a file named Dockerfile. Open a terminal and navigate to the directory containing the Dockerfile. Build and Run the image. This will start a container with both kubectl and the Azure CLI installed, and you will be dropped into a bash shell where you can use these tools.

    If you have any further queries, let me know. If the information is helpful, please click on Upvote.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.