測試新的映像檔

  1. 查看 centos 映像檔,多了一個 TAG 為 mydir 的映像檔。
    [root@dyw219 newimg]# docker images centos
    REPOSITORY     TAG        IMAGE ID         CREATED             VIRTUAL SIZE
    centos         mydir      9fe04fab671a     7 minutes ago       201.8 MB
    centos         myfile     25f7f65b6de0     About an hour ago   201.8 MB
    centos         latest     ee2526f4865b     5 months ago        201.8 MB
    
  2. 使用新的映像檔 centos:mydir 執行 /bin/bash。
    [root@dyw219 newimg]# docker run -it centos:mydir /bin/bash
    
  3. 進入系統後執行 mydir/start.sh,成功輸出日期時間。
    [root@90fb625a3287 /]# mydir/start.sh 
    Thu Aug 15 11:35:41 UTC 2019
    
  4. 退出 centos:mydir 容器
    [root@90fb625a3287 /]# exit
    exit