Build Microsoft Teams PowerShell Docker Image Using Dockerfile

In this blog post, I will show you how to create a Dockerfile for Microsoft Teams PowerShell administration.

Using Microsoft official PowerShell 7 Core Docker Container image, we can manage MS Teams for Docker.

The image is using Ubuntu Linux image, and the Dockerfile installs the latest beta version the Teams module.


The first step in this process will be creating a Dockerfile using the following command.

Note: I am using CentOS 7.7

nano dockerfile

Next, I will copy and paste the lines below to the file and save.

RUN pwsh -command register-PSRepository -Name PSGalleryInt -SourceLocation -InstallationPolicy Trusted
RUN pwsh -command install-Module microsoftteams -Repository PSGalleryInt
CMD ["pwsh"]

Build Image

To build the image, I will run the following command.

Note: The image name will be msteams.

docker build -t msteams .

 Run and log in to MS Teams

The final step will be deploying a container from the image using the command below:

docker container run -it  msteams

After the container started, I will import the MS Teams module using the line below:

Import-module microsoftteams

To connect, I will type:


Success! You're on the list.

1 thought on “Build Microsoft Teams PowerShell Docker Image Using Dockerfile”

  1. Thank you, that is brilliant. I ran it on my Mac and it works great. Any reason not to put the lines:

    Import-module microsoftteams

    in the dockerfile?


Comments are closed.