使用
docker commit
命令打包容器为镜像
//docker commit 容器名称 镜像名称:标签名称
docker commit ubuntu20 123456789/ubuntu:ubuntu20.04-php7.4-myqsl8-nginx
sha256:e16c769ccba5fea85aab236b8898d05c455b322d718b4471f6df0c2729f16922
docker login 123456789@qq.com
登录docker账号,根据提示输入密码
//根据提示输入账号和密码
PS C:\Users\Administrator> docker login 123456789@qq.com
Authenticating with existing credentials...
Login Succeeded
docker images
查看本地镜像
PS C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID SIZE
ubuntu20.04/php7.4/mysql8 lnmp b55842d22356 1.22GB
hyperf/hyperf 7.4-alpine-v3.11-swoole 8d212062446b 124MB
docker tag b5584 123456789/ubuntu:ubuntu20.04-php7.4-myqsl8
创建新标签
//docker tag 镜像ID docker账号/存储库:标签名称
docker tag b5584 123456789/ubuntu:ubuntu20.04-php7.4-myqsl8
docker push 123456789/ubuntu:ubuntu20.04-php7.4-myqsl8-nginx
推送标签到存储库,提示成功后到ubuntu存储库
//docker push docker账号/存储库:标签名称
docker push 123456789/ubuntu:ubuntu20.04-php7.4-myqsl8-nginx