docker:制作本地容器镜像(七)

首先需要在https://hub.docker.com/有账号

登录

[root@test191 ~]# docker login

输入用户名、密码登录

查看运行容器

[root@test191 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                        NAMES
5b22ba5d096b        7e6257c9f8d8        "/bin/bash"         3 hours ago         Up 37 minutes       127.0.0.1:42014->42014/tcp   boring_rubin

选择一个容器,进行打包为镜像
docker commit 容器id 设置打包为镜像的名字

[root@test191 ~]# docker commit 5b22ba5d096b pdf_util
sha256:f4f8b14c93fa5f59431ae101b22a45609c62c8a78e2229982d16dfc7a8dadcd2

查看镜像

[root@test191 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
pdf_util            latest              f4f8b14c93fa        10 seconds ago      1.43GB
centos              7                   7e6257c9f8d8        2 months ago        203MB

标记

[root@test191 ~]# docker tag pdf_util test111/centos_pdf_util
[root@test191 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
pdf_util                latest              f4f8b14c93fa        2 minutes ago       1.43GB
test111/centos_pdf_util latest              f4f8b14c93fa        2 minutes ago       1.43GB
centos                  7                   7e6257c9f8d8        2 months ago        203MB

上传

[root@test191 ~]# docker push test111/centos_pdf_util

Guess you like

Origin blog.csdn.net/ASAS1314/article/details/109446111