docker_practice/repository/dockerhub.md

99 lines
4.6 KiB
Go
Raw Normal View History

# Docker Hub
2017-11-24 22:42:49 +08:00
Docker [Docker Hub](https://hub.docker.com/),其中已经包括了数量超过 [2,650,000](https://hub.docker.com/search/?type=image) 的镜像。大部分需求都可以通过在 Docker Hub 中直接下载镜像来实现。
2017-11-24 22:42:49 +08:00
##
2017-11-24 22:42:49 +08:00
2018-12-14 19:36:17 +08:00
https://hub.docker.com 免费注册一个 Docker 账号。
2017-11-24 22:42:49 +08:00
##
2014-09-17 20:18:51 +08:00
2017-11-24 22:42:49 +08:00
`docker login` Docker Hub
`docker logout` 退
##
2017-11-24 22:42:49 +08:00
`docker search` `docker pull`
2014-09-17 20:18:51 +08:00
2017-11-24 22:42:49 +08:00
`centos`
2017-11-13 18:54:38 +08:00
```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]
2014-09-17 20:18:51 +08:00
```
2017-11-24 22:42:49 +08:00
`OFFICIAL` `AUTOMATED`
2017-11-24 22:42:49 +08:00
2019-03-08 12:21:07 +08:00
2014-09-26 17:45:51 +08:00
2017-11-24 22:42:49 +08:00
`centos` Docker 使
`ansible/centos7-ansible` Docker Hub `username/` 使 ansible
2017-11-24 22:42:49 +08:00
`--filter=stars=N` `N`
`centos`
2014-09-26 17:45:51 +08:00
2017-11-13 18:54:38 +08:00
```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
2014-09-17 20:18:51 +08:00
```
2017-11-24 22:42:49 +08:00
##
2017-11-24 22:42:49 +08:00
`docker push` Docker Hub
`username` Docker
```bash
$ docker tag ubuntu:18.04 username/ubuntu:18.04
2017-11-24 22:42:49 +08:00
2017-12-05 11:15:24 +08:00
$ docker image ls
2017-11-24 22:42:49 +08:00
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
2017-11-24 22:42:49 +08:00
$ docker push username/ubuntu:18.04
2017-11-24 22:42:49 +08:00
$ docker search username
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
username/ubuntu
```
2014-09-17 20:18:51 +08:00
##
2017-11-24 22:42:49 +08:00
> 2021 7 26 [](https://www.docker.com/blog/changes-to-docker-hub-autobuilds/)使用。
2022-05-13 05:37:08 +08:00
`Automated Builds`便
2014-09-17 20:18:51 +08:00
2019-03-08 12:21:07 +08:00
2017-11-24 22:42:49 +08:00
Docker Hub [GitHub](https://github.com) 或 [BitBucket](https://bitbucket.org))上的项目,一旦项目发生新的提交 `commit`)或者创建了新的标签(`tag`Docker Hub 会自动构建镜像并推送到 Docker Hub 中。
2014-09-17 20:18:51 +08:00
2019-03-08 12:21:07 +08:00
2017-11-24 22:42:49 +08:00
2019-03-08 12:21:07 +08:00
* Docker Hub
2017-11-24 22:42:49 +08:00
* Docker Hub `Account Settings``Linked Accounts`
2017-11-24 22:42:49 +08:00
2019-03-08 12:21:07 +08:00
* Docker Hub `Builds` `Configure Automated Builds`
2014-09-17 20:18:51 +08:00
2017-11-24 22:42:49 +08:00
* `Dockerfile`
2019-03-08 12:21:07 +08:00
* `Dockerfile`
2017-11-24 22:42:49 +08:00
2019-03-08 12:21:07 +08:00
Docker Hub `Timeline`