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)