docker_practice/image/pull.md

69 lines
4.1 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
92dc2a97ff99: Pull complete
be13a9d27eb8: Pull complete
c8299583700a: Pull complete
Digest: sha256:4bc3ae6596938cb0d9e5ac51a1152ec9dcac2a1c50829c74abd9c4361e321b26
Status: Downloaded newer image for ubuntu:18.04
docker.io/library/ubuntu:18.04
```
Docker Docker Hub `docker.io` `ubuntu:18.04` `library/ubuntu` `18.04` `docker pull` `docker.io/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` 退