This PowerShell and Docker post will show how we install PowerShell on a Docker container running Ubuntu using a Dockerfile.
Building images with Dockerfile is something that gives DevOps engineers and Developers greater control over the deployment. Dockerfile allows us to build images that are custom and tailored to our needs.
Building your image. Go to the directory that has your Dockerfile and run the following command to build the Docker image. The -t flag lets you tag your image so it's easier to find later using the docker images command: docker build.t /node-web-app. Your image will now be listed by Docker.
In the following Dockerfile code, I build a Docker image using Ubuntu latest image and installing the latest PowerShell 7 image.
The last line is optional, and in that line, I run the RUN statement with parameters. The line runs a PowerShell 7 command that prints out the version of PowerShell.
To build the image, please visit the following post.