- 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.
推薦閱讀
- C++面向對象程序設計(第三版)
- 零基礎搭建量化投資系統:以Python為工具
- Python數據分析入門與實戰
- Mastering RabbitMQ
- JavaScript+jQuery網頁特效設計任務驅動教程(第2版)
- Java Web基礎與實例教程(第2版·微課版)
- 算法精粹:經典計算機科學問題的Java實現
- 編寫高質量代碼:改善C程序代碼的125個建議
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Drupal 8 Configuration Management
- concrete5 Cookbook
- R大數據分析實用指南
- 微信小程序全棧開發技術與實戰(微課版)
- HTML5秘籍(第2版)
- App Inventor創意趣味編程進階