Using a Dockerfile to create and use a container

Containers can be used in a variety of ways. In most cases, you are going to want to build your own custom images, complete with an operating system, OS features, and applications. A great way to build your image is to use a Dockerfile containing the instructions for building a new image, and then use the docker build command to create a customized container you can then run.

Getting ready

In this recipe, you use the container host, CH1, that you set up in the Configuring a container host recipe.

How to do it...

  1. Create a folder and Set-Location to the folder on CH1:
    $SitePath = 'C:\RKWebContainer' $NIHT = @{ Path = $SitePath ItemType = 'Directory' ErrorAction = 'SilentlyContinue' } New-Item @NIHT | Out-Null ...

Get Windows Server 2019 Automation with PowerShell Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.