Docker镜像管理
约 440 字
预计阅读 1 分钟
次阅读
安装docker
1
2
3
4
5
6
7
8
9
|
Centos6.6_x64
[root@web1 ~]# uname -a
Linux web1.mulinux.com 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@web1 ~]# yum install -y epel-release
[root@web1 ~]# yum install -y docker-io
[root@web1 ~]# /etc/init.d/docker start
[root@web1 ~]# ps aux | grep docker
root 1591 1.0 1.4 287656 14224 pts/0 Sl 18:30 0:00 /usr/bin/docker -d
root 1709 0.0 0.0 103244 864 pts/0 S+ 18:31 0:00 grep docker
|
镜像管理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
[root@web1 ~]# docker pull centos
latest: Pulling from centos
47d44cb6f252: Pull complete
6fdebd7b0eb5: Pull complete
a63aae4d216f: Pull complete
bb3d629a7cbc: Pull complete
Digest: sha256:381f21e4c7b3724c6f420b2bcfa6e13e47ed155192869a2a04fa10f944c78476
Status: Downloaded newer image for centos:latest
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
[root@web1 ~]# docker tag centos mulinux123
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
mulinux123 latest bb3d629a7cbc 2 weeks ago 196.6 MB
[root@web1 ~]# docker run -it centos /bin/bash #用镜像开启容器
[root@32c67b2b18e0 /]# w
12:30:01 up 2:09, 0 users, load average: 0.06, 0.01, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
[root@32c67b2b18e0 /]# exit
exit
[root@web1 ~]# docker ps #查看运行的容器
[root@web1 ~]# docker ps -a #可以查看到没有运行的容器
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
32c67b2b18e0 centos "/bin/bash" 2 minutes ago Exited (0) About a minute ago modest_kowalevski
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
mulinux123 latest bb3d629a7cbc 2 weeks ago 196.6 MB
[root@web1 ~]# docker rmi bb3d629a7cbc #删除ID会导致同id的所有都删除
[root@web1 ~]# docker rmi mulinux123
Untagged: mulinux123:latest
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
[root@web1 ~]# docker tag centos centos:mulinux
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
centos mulinux bb3d629a7cbc 2 weeks ago 196.6 MB
[root@web1 ~]# docker rmi centos:mulinux
Untagged: centos:mulinux
[root@web1 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
centos latest bb3d629a7cbc 2 weeks ago 196.6 MB
|