docker_practice/repository/dockerhub.md

99 lines
4.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Docker Hub
Docker [Docker Hub](https://hub.docker.com/),其中已经包括了数量超过 [2,650,000](https://hub.docker.com/search/?type=image) 的镜像。大部分需求都可以通过在 Docker Hub 中直接下载镜像来实现。
##
https://hub.docker.com 免费注册一个 Docker 账号。
##
`docker login` Docker Hub
`docker logout` 退
##
`docker search` `docker pull`
`centos`
```bash
$ docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 6449 [OK]
ansible/centos7-ansible Ansible on Centos7 132 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 126 [OK]
jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 117 [OK]
centos/systemd systemd enabled base container. 96 [OK]
```
`OFFICIAL` `AUTOMATED`
`centos` Docker 使
`ansible/centos7-ansible` Docker Hub `username/` 使 ansible
`--filter=stars=N` `N`
`centos`
```bash
$ docker pull centos
Using default tag: latest
latest: Pulling from library/centos
7a0437f04f83: Pull complete
Digest: sha256:5528e8b1b1719d34604c87e11dcd1c0a20bedf46e83b5632cdeac91b8c04efc1
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
```
##
`docker push` Docker Hub
`username` Docker
```bash
$ docker tag ubuntu:18.04 username/ubuntu:18.04
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 275d79972a86 6 days ago 94.6MB
username/ubuntu 18.04 275d79972a86 6 days ago 94.6MB
$ docker push username/ubuntu:18.04
$ docker search username
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
username/ubuntu
```
##
> 2021 6 18 [](https://www.docker.com/blog/changes-to-docker-hub-autobuilds/)使用。
`Automated Builds`便
Docker Hub [GitHub](https://github.com) 或 [BitBucket](https://bitbucket.org))上的项目,一旦项目发生新的提交 `commit`)或者创建了新的标签(`tag`Docker Hub 会自动构建镜像并推送到 Docker Hub 中。
* Docker Hub
* Docker Hub `Account Settings``Linked Accounts`
* Docker Hub `Builds` `Configure Automated Builds`
* `Dockerfile`
* `Dockerfile`
Docker Hub `Timeline`