docker_practice/repository/dockerhub.md

96 lines
4.4 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. 465 [OK]
tianon/centos CentOS 5 and 6, created using rinse instea... 28
blalor/centos Bare-bones base CentOS 6.5 image 6 [OK]
saltstack/centos-6-minimal 6 [OK]
tutum/centos-6.4 DEPRECATED. Use tutum/centos:6.4 instead. ... 5 [OK]
```
OFFICIAL AUTOMATED
`centos` Docker 使
`tianon/centos` Docker Hub `username/` 使 tianon
`--filter=stars=N` `N`
`centos`
```bash
$ docker pull centos
Pulling repository centos
0b443ba03958: Download complete
539c0211cd76: Download complete
511136ea3c5a: Download complete
7064731afe90: Download complete
```
###
`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
```
###
Automated Builds便
Docker Hub [GitHub](https://github.com) 或 [BitBucket](https://bitbucket.org))上的项目,一旦项目发生新的提交 commit或者创建了新的标签tagDocker Hub 会自动构建镜像并推送到 Docker Hub 中。
* Docker Hub
* Docker Hub Account SettingsLinked Accounts
* Docker Hub `Builds` `Configure Automated Builds`
* `Dockerfile`
* `Dockerfile`
Docker Hub `Timeline`