docker_practice/image/pull.md

72 lines
4.0 KiB
Go
Raw 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
docker pull [] [Docker Registry [:]/][:]
```
`docker pull --help`
2017-12-01 17:33:05 +08:00
* Docker `<域名/IP>[:端口号]` Docker Hub
2017-11-22 20:28:10 +08:00
* `<用户名>/<软件名>` 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使
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` 退