- Docker on Windows
- Elton Stoneman
- 283字
- 2021-07-02 12:47:55
Building an image from a Dockerfile
Now that you have a Dockerfile, you use the docker command line to build it into an image. Like most Docker commands, the image build command is straightforward and has very few required options, preferring conventions instead.
To build an image, open a command line and navigate to the directory where your Dockerfile is. Then, run docker image build and give your image a tag, which is the name that will identify the image:
docker image build --tag dockeronwindows/ch02-powershell-env:2e .
Every image needs a tag, specified with the --tag option, which is a unique identifier for the image in your local image cache and in image registries. The tag is how you'll refer to the image when you run containers. A full tag specifies the registry to use: the repository name, which is the identifier for the application, and a suffix, which is the identifier for this version of the image.
When you're building an image for yourself, you can call it anything, but the convention is to name your repository as your username for the registry, followed by the application name: {user}/{app}. You can also use the tag to identify application versions or variations, such as sixeyed/git and sixeyed/git:2.17.1-windowsservercore-ltsc2019, which are two of my images on Docker Hub.
The period at the end of the image build command tells Docker the location of the context to use for the image. . is the current directory. Docker copies the contents of the directory tree into a temporary folder for the build, so the context needs to contain any files you reference in the Dockerfile. After copying the context, Docker starts executing the instructions in the Dockerfile.
- Modern Web Testing with TestCafe
- Implementing Cisco UCS Solutions
- Linux系統文件安全實戰全攻略
- Windows Server 2012 Hyper-V Cookbook
- Windows Phone 7.5 Data Cookbook
- 嵌入式實時操作系統μC/OS原理與實踐
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- STM32庫開發實戰指南:基于STM32F4
- Introduction to R for Quantitative Finance
- Web Penetration Testing with Kali Linux(Third Edition)
- OpenStack Essentials(Second Edition)
- 基于Arduino的嵌入式系統入門與實踐
- 樹莓派+傳感器:創建智能交互項目的實用方法、工具及最佳實踐
- Instant Responsive Web Design
- 分布式實時處理系統:原理、架構與實現