Try   HackMD

Docker 替本機映像檔加標籤名稱

tags: Docker 工作紀錄 WSL VSCode

docker images 列出本機映像檔

首先輸入

docker images

可以顯示目前本機上的映象檔

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

docker rmi 刪除映像檔

如果想先刪除映象檔可以輸入

docker rmi tldefrontendhost:dev

# 刪除所有映象檔
docker system prune -a --volumes

就能刪除 tldefrontendhost:dev 的映象檔
接下來給映象檔上個 Tag 輸入

docker rmi tldefrontendhost:dev

docker tag 替本機映像檔加標籤名稱

一個映像檔可以有很多不同的 tag
為了方便作業,我們常常會給同一個映像檔不同的 tag

內部規則為 DEV ECR 的 URL後面加版本號,如下:

所以輸入下列指令上 Tag

docker tag tldefrontendhost:dev 966385500434.dkr.ecr.us-west-2.amazonaws.com/tlde.service:Release-1.0.0.0

可以看到前後紅色區塊在輸入指令後,新增了一個映象檔,且上了一個 Release-1.0.0.0 的 Tag
REPOSITORY 名稱也改變了,但是 IMAGE ID 卻是一樣的

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →