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...
Create a folder and
Set-Location
to the folder onCH1
:$SitePath = 'C:\RKWebContainer' $NIHT = @{ Path = $SitePath ItemType = 'Directory' ErrorAction = 'SilentlyContinue' } New-Item @NIHT | Out-Null Set-Location -Path $NIHT.Path
Create a script to run in the container to create a new site in the container:
$SB = { # 2.1 create folder in the container $SitePath = 'C:\RKWebContainer' $NIHT = @{ Path = $SitePath ...