Cài đặt IIS và thêm nó làm image cho containers. Containers được tạo mỗi lần để thực thi lệnh chạy Docker, vì vậy hãy thêm containers được thực thi mới nhất như sau
# display images
PS C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mcr.microsoft.com/windows/servercore 1809 640a8acbeb6f 6 days ago 4.28GB
# start a Container and install IIS
PS C:\Users\Administrator> docker run mcr.microsoft.com/windows/servercore:1809 powershell -c "dism.exe /online /enable-feature /all /featurename:iis-webserver /NoRestart"
Deployment Image Servicing and Management tool
Version: 10.0.17763.1
Image Version: 10.0.17763.316
Enabling feature(s)
The operation completed successfully.
PS C:\Users\Administrator> (docker ps -a)[0..1]
CONTAINER ID IMAGE COMMAND CREATED STATUS
PORTS NAMES
b8935d684c30 mcr.microsoft.com/windows/servercore:1809 "powershell -c 'dism" 2 minutes ago Exited (0) About a minute ago serene_brahmagupta
# add the image
PS C:\Users\Administrator> docker commit b8935d684c30 srv.world/iis
sha256:1f0cbc310aaa3c4f508827dc59be7d5def17235abfbf1fc335b6eafadc4961c5
# display images
PS C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
srv.world/iis latest 1f0cbc310aaa 30 seconds ago 4.43GB
mcr.microsoft.com/windows/servercore 1809 640a8acbeb6f 6 days ago 4.28GB
# generate a container from the new image and verify IIS is running to access to container's localhost
PS C:\Users\Administrator> docker run srv.world/iis powershell -c "curl.exe localhost"
IIS Windows Server
DỊch vụ
- Chỗ đặt máy chủ
- Thuê máy chủ
- Máy chủ ảo
- Private Cloud
- Web Hosting
- Email Hosting
CÔNG TY
- Hoạt động
- Data Center
- Blog
- Chính sách
- Liên hệ
GIẢI PHÁP
- Sao lưu và phục hồi dữ liệu
- Xây dựng Private Cloud
- Hạ tầng máy chủ
- Xây dựng website