一、使用docker命令管理docker镜像
1.使用docker命令下载ubuntu:18.04和ubuntu:latest镜像
2.使用docker命令下载hub.c.163.com/library/centos:7.4.1708镜像
[root@localhost ~]# docker pull ubuntu:18.04
18.04: Pulling from library/ubuntu
726b8a513d66: Pull complete
Digest: sha256:6fec50623d6d37b7f3c14c5b6fc36c73fd04aa8173d59d54dba00da0e7ac50ee
Status: Downloaded newer image for ubuntu:18.04
docker.io/library/ubuntu:18.04
[root@localhost ~]# docker pull ubuntu:latest
latest: Pulling from library/ubuntu
2b55860d4c66: Pull complete
Digest: sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 35b3f4f76a24 8 hours ago 63.1MB
ubuntu latest 2dc39ba059dc 5 days ago 77.8MB
[root@localhost ~]# docker pull hub.c.163.com/library/centos:7.4.1708
7.4.1708: Pulling from library/centos
840caab23da4: Pull complete
Digest: sha256:78b63c089c40a2ca0d85db9125fb3193c6ff74814bba5f894c803e5ae02a4035
Status: Downloaded newer image for hub.c.163.com/library/centos:7.4.1708
hub.c.163.com/library/centos:7.4.1708
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 18.04 35b3f4f76a24 8 hours ago 63.1MB
ubuntu latest 2dc39ba059dc 5 days ago 77.8MB
hub.c.163.com/library/centos 7.4.1708 9f266d35e02c 3 years ago 197MB
3.使用docker命令通过ubuntu:18.04镜像生成容器,容器在后台运行,且容器名为myubuntu
[root@localhost ~]# docker run -it -d --name myubuntu ubuntu:18.04
fcb17aae2ab09aa15467bf2f05e247d414236985fcb9607663