docker_practice/image/pull.md

70 lines
4.0 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](https://hub.docker.com/search?q=&type=image) 上有大量的高质量的镜像可以用,这里我们就说一下怎么获取这些镜像。
Docker `docker pull`
```bash
docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签]
```
`docker pull --help`
* Docker `<域名/IP>[:端口号]` Docker Hub(docker.io)
* `<用户名>/<软件名>` Docker Hub `library`
```bash
$ docker pull ubuntu:18.04
18.04: Pulling from library/ubuntu
bf5d46315322: Pull complete
9f13e0ac480c: Pull complete
e8988b5b3097: Pull complete
40af181810e7: Pull complete
e6f7c7e5c03e: Pull complete
Digest: sha256:147913621d9cdea08853f6ba9116c2e27a3ceffecf3b492983ae97c3d643fbbe
Status: Downloaded newer image for ubuntu:18.04
```
Docker Docker Hub `ubuntu:18.04` `library/ubuntu` `18.04`
ID 12 `sha256`
使 ID `sha256` bug使
* Docker Hub [](/install/mirror.md) *
##
`ubuntu:18.04` `bash`
```bash
$ docker run -it --rm ubuntu:18.04 bash
root@e7009c6ce357:/# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
```
`docker run` [](../container)
* `-it` `-i` `-t` `bash`
* `--rm`退退 `docker rm`便使 `--rm`
* `ubuntu:18.04` `ubuntu:18.04`
* `bash` **** Shell `bash`
Shell `cat /etc/os-release` Linux `Ubuntu 18.04.1 LTS`
`exit` 退