docker_practice/image/pull.md

69 lines
4.1 KiB
Go
Raw Permalink Normal View History

#
[Docker Hub](https://hub.docker.com/search?q=&type=image) 上有大量的高质量的镜像可以用,这里我们就说一下怎么获取这些镜像。
2017-12-01 17:33:05 +08:00
Docker `docker pull`
```bash
2021-03-11 23:09:37 +08:00
$ docker pull [] [Docker Registry [:]/][:]
```
`docker pull --help`
2021-03-11 23:09:37 +08:00
* Docker `<域名/IP>[:端口号]` Docker Hub(`docker.io`)
2017-11-22 20:28:10 +08:00
* `<用户名>/<软件名>` 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
```
2021-03-11 23:09:37 +08:00
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使
2017-09-16 10:27:27 +08:00
* 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
```
2017-12-20 23:44:47 +08:00
`docker run` [](../container)
* `-it` `-i` `-t` `bash`
* `--rm`退退 `docker rm`便使 `--rm`
* `ubuntu:18.04` `ubuntu:18.04`
2019-03-08 12:21:07 +08:00
* `bash` **** Shell `bash`
Shell `cat /etc/os-release` Linux `Ubuntu 18.04.1 LTS`
`exit` 退