How to do it...

In this recipe, we are going to see the complete life cycle of a Docker image by using PowerShell Docker cmdlets in conjunction with Docker CLI commands:

  1. Open a Terminal and enter root mode.
  2. Launch PowerShell using pwsh.
  3. Log in to the Docker registry using your Docker username and password credentials or using a standard file as an input for the password. The second option is not recommended, for security reasons:
# docker login
  1. Now, pull the sample hello-world:latest image from the Docker Hub using the Pull-ContainerImage cmdlet:
PS> Pull-ContainerImage hello-world:latest 
  1. To run the container image, use the Run-ContainerImage ...

Get PowerShell Core for Linux Administrators Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.