美文网首页
如何构建镜像发布到docker的公共仓库

如何构建镜像发布到docker的公共仓库

作者: Atomas | 来源:发表于2020-11-06 18:16 被阅读0次

1. 创建账号  https://hub.docker.com/

2.  在本地登入验证 docker login

     Q: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

     A: 说明docker服务没有启动。 运行命令: systemctl docker start 即可!

3.  构建镜像

      如何把自己的应用打包成镜像?

      docker build -t tomas7tu:higo https://github.com/tomas-tu/higo.git

      Q: unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /tmp/docker-build-git240721282/Dockerfile: no such file                  or  directory

      A: 说明你拉取的github仓库没有包含dockerfile文件

4.  给刚构建的镜像打标签

        查看所有的镜像: docker images

        docker tag image_id  docker_id/repository:tag (tomas7tu/higo:v1.0)

5.  把构建好的镜像提交到公共仓库  

       docker   push  docker_id/repository:tag (tomas7tu/higo:v1.0)

相关文章

网友评论

      本文标题:如何构建镜像发布到docker的公共仓库

      本文链接:https://www.haomeiwen.com/subject/sqmtbktx.html