Docker镜像发布到Docker Hub
小王格子 人气:1在使用docker过程中,往往会用到镜像仓库,方便管理的同时也方便在其他环境下快速下载镜像,本文讲解如何将镜像传入docker官方仓库。操作系统以CentOS 8 为例讲解如何将自己的镜像上传到docker hub。
一、Docker 官网注册一个账号,新建仓库
二、制作镜像,保存修改后的容器镜像为例
# 本次不以docker build 为例 # docker ps -a Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 236cd97f7854 docker.io/oddrationale/docker-shadowsocks:latest -s 0.0.0.0 -p 123... 4 seconds ago Up 3 seconds ago 0.0.0.0:12345->12345/tcp unruffled_hamilton # 拷贝宿主的文件进容器/tmp目录 # docker cp /data/shadowsock/config.json 236cd97f7854:/tmp # docker commit 236cd97f7854 shadowsock-feb # docker images Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. REPOSITORY TAG IMAGE ID CREATED SIZE localhost/shadowsock-feb latest 55c10922d371 18 hours ago 438 MB docker.io/oddrationale/docker-shadowsocks latest 4cbc49994ade 3 years ago 438 MB
三、镜像上传
# 重新打标签,镜像重命名使之与Docker Hub账号仓库匹配,格式: 用户名/仓库名 # docker tag 55c10922d371 skypipi/shadowsock Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. # docker images Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. REPOSITORY TAG IMAGE ID CREATED SIZE localhost/shadowsock-feb latest 55c10922d371 18 hours ago 438 MB localhost/skypipi/shadowsock latest 55c10922d371 18 hours ago 438 MB docker.io/oddrationale/docker-shadowsocks latest 4cbc49994ade 3 years ago 438 MB # 指定 docker.io 地址,否则就登录到redhat官网了 # docker login docker.io Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Username: skypipi Password: Login Succeeded! # docker push skypipi/shadowsock Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Getting image source signatures ....... Copying config 55c10922d3 done Writing manifest to image destination Storing signatures
四、镜像下载
通过官网下载
通过命令下载
# docker pull skypipi/shadowsock:latest
加载全部内容