root@knight:/# docker commit -m "add net-tools package" -a "lxp" nginx-1 mynginx:1.1 sha256:f35ce030ad1119c6fe4a1398386048ad51471e80a672c55912b46f157d1554c2 root@knight:/# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mynginx 1.1 f35ce030ad11 11 seconds ago 198MB mynginx 1.0 ff65638c821e 5 hours ago 196MB
更改镜像名称
上传到本地私有仓库需要满足一定的镜像名称上传规范,需要对mynginx:1.1进行改名:
当前我电脑的IP为:192.168.1.42。
1
docker tag mynginx:1.1 192.168.1.42:5000/mynginx:1.1
效果如下:
1 2 3 4 5 6
root@knight:/# docker tag mynginx:1.1 192.168.1.42:5000/mynginx:1.1 root@knight:/# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.42:5000/mynginx 1.1 f35ce030ad11 13 minutes ago 198MB mynginx 1.1 f35ce030ad11 13 minutes ago 198MB mynginx 1.0 ff65638c821e 5 hours ago 196MB
root@knight:/# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.42:5000/mynginx 1.1 f35ce030ad11 About an hour ago 198MB mynginx 1.1 f35ce030ad11 About an hour ago 198MB nginx latest 605c77e624dd 19 months ago 141MB registry latest b8604a3fe854 21 months ago 26.2MB root@knight:/# docker rmi 192.168.1.42:5000/mynginx:1.1 Untagged: 192.168.1.42:5000/mynginx:1.1 Untagged: 192.168.1.42:5000/mynginx@sha256:e8c89fef743b31184833c6e08d0415c3e5cdd38770dcb584b1ad6173c64df4a4 root@knight:/# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mynginx 1.1 f35ce030ad11 About an hour ago 198MB nginx latest 605c77e624dd 19 months ago 141MB registry latest b8604a3fe854 21 months ago 26.2MB root@knight:/# docker pull 192.168.1.42:5000/mynginx:1.1 1.1: Pulling from mynginx Digest: sha256:e8c89fef743b31184833c6e08d0415c3e5cdd38770dcb584b1ad6173c64df4a4 Status: Downloaded newer image for 192.168.1.42:5000/mynginx:1.1 192.168.1.42:5000/mynginx:1.1 root@knight:/# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.42:5000/mynginx 1.1 f35ce030ad11 About an hour ago 198MB mynginx 1.1 f35ce030ad11 About an hour ago 198MB nginx latest 605c77e624dd 19 months ago 141MB registry latest b8604a3fe854 21 months ago 26.2MB