- Hands-On Kubernetes on Windows
- Piotr Tylenda
- 252字
- 2021-06-24 16:53:59
Building a Docker image
Building a Docker image is performed using the docker build command. You have two options when it comes to performing this step:
- Use Visual Studio Code's Command Palette.
- Use the Powershell command line.
In Visual Studio Code, do the following:
- Use the Ctrl + Shift + P shortcut in order to open the Command Palette.
- Search for Docker: Build Image and execute it by providing the image name and tag in the following format (or use the default suggested name based on the directory name):
<image name>:<tag>
- If you are logged into a custom registry or using Docker Hub, you can also specify the following:
<registry or username>/<image name>:<tag>
The concepts of Docker Registry and the public Docker Hub will be covered in Chapter 3, Working with Container Images.
We will use the following image name and tag in this example: docker-helloworld-iis:latest.
The Visual Studio Code command is equivalent to performing the following actions in Powershell:
- Change the working directory to the folder that contains the Dockerfile; for example:
cd c:\src\Hands-On-Kubernetes-on-Windows\Chapter01\docker-helloworld-iis
- Execute the docker build command while specifying the -t argument in order to provide the image name and tag and use the current directory, ., as the build context:
docker build -t docker-helloworld-iis:latest .
The following screenshot shows the output of the preceding command:
After a successful build, you can use the docker-helloworld-iis local image to create new containers. We will cover this in the next subsection.
推薦閱讀
- Kibana Essentials
- Monkey Game Development:Beginner's Guide
- Ext JS Data-driven Application Design
- ASP.NET Core Essentials
- Mastering matplotlib
- 數據結構與算法JavaScript描述
- 數據結構(Python語言描述)(第2版)
- Kotlin Standard Library Cookbook
- jQuery開發基礎教程
- 第一行代碼 C語言(視頻講解版)
- Node.js:來一打 C++ 擴展
- 從0到1:HTML5 Canvas動畫開發
- Instant Automapper
- OpenCV 3.0 Computer Vision with Java
- Visual Basic程序設計基礎