標籤:container enter uil log bsp 更改 機器 發布 conf
安裝包:點擊此處
Docker for Windows
Get started with Docker for Windows
環境設值:
- Shared Drivers:可以將主機(也就是Windows機器)中的磁碟機共用到Docker Container中
- Advanced:用於配置運行Docker Daemon的虛擬環境的CPU和記憶體
- Network:配置Docker的網路環境
- Proxies:代理的配置
- Docker Daemon:使用JSON格式的設定,對Docker Daemon進行配置,類似於在Linux環境中使用conf檔案對Docker進行配置
Docker for Windows的安裝過程會在Hyper-V中建立一台用於運行Docker Daemon的Linux虛擬機器,這個對話方塊中的很多配置也就是針對該虛擬機器所作出的配置。當配置發生更改後,Docker for Windows會重新啟動(小鯨魚背上的小方塊又會動起來),這個過程其實就是這台Linux虛擬機器的配置進行動態調整和重啟的過程。
在Docker for Windows成功啟動後,就可以在Windows命令提示字元下執行Docker命令了,也可以在Power Shell中執行Docker命令,看個人喜好吧。Docker CLI的體驗和Linux下是一樣的。
使用Docker for Windows在容器中運行ASP.NET Core Web API應用程式
1.首先確保Dockerfile檔案與發布出來的DockerWebAPI應用程式的檔案都在同一個目錄下:
2.啟動power shell,在程式目錄下 執行docker build . -t tagName
與Linux下編譯Docker Image相比,這裡多了一個安全警告。這是因為我們是在Windows下使用部署在非Windows中的Docker服務來完成的Image的編譯產生,兩套系統中的檔案使用權限設定不同。Docker for Windows建議在編譯產生的Image上對檔案的許可權進行檢查以確保安全。
3.docker run 命令
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
Type exit
to stop the container and close the powershell.
4.瀏覽器輸入url ,測試webapi介面
配置
Shared Drives
Share your local drives (volumes) with Docker for Windows, so that they are available to your containers.
You will be asked to provide your Windows system username and password (domain user) to apply shared drives. You can select an option to have Docker store the credentials so that you don’t have to re-enter them every time.
Docker for Windows