标签:ports ash link roo 基础 ica ges :link 运行
# docker search Ubuntu # 搜索镜像
# docker pull ubuntu # 获取 ubuntu 官方镜像
# docker images # 查看当前镜像列表
# docker run -i -t ubuntu:14.04 /bin/bash docker run -启动一个docker容器 -t - 分配一个(伪)tty (link is external) -i - 交互模式 (so we can interact with it) ubuntu:14.04 - 使用 ubuntu 基础镜像 14.04 /bin/bash - 运行命令 bash shell 注: ubuntu 会有多个版本,通过指定tag来启动特定的版本 [image]:[tag]运行命令测试
[root@boxiaoyuan ~]# docker run -it centos:6 /bin/bash [root@fa0101ec9408 /]# ifconfig eth0 Link encap:Ethernet HWaddr 02:42:AC:11:00:04 inet addr:172.17.0.4 Bcast:0.0.0.0 Mask:255.255.0.0 inet6 addr: fe80::42:acff:fe11:4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:5 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:238 (238.0 b) TX bytes:418 (418.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [root@fa0101ec9408 /]# cat /etc/centos-release CentOS release 6.10 (Final) [root@fa0101ec9408 /]# exit exit [root@boxiaoyuan ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fa0101ec9408 centos:6 "/bin/bash" 36 seconds ago Exited (0) 5 seconds ago adoring_mestorf 635a6d6ecc18 centos:6 "/bin/bash" 3 minutes ago Exited (0) About a minute ago reverent_einstein bcd12a83d56a ubuntu:14.04 "/bin/bash" 11 minutes ago Exited (0) 8 minutes ago evil_meitner 3ea8b1a018bc hello-world "/hello" 51 minutes ago Exited (0) 51 minutes ago drunk_lumiere [root@boxiaoyuan ~]# docker start fa0101ec9408 fa0101ec9408 [root@boxiaoyuan ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fa0101ec9408 centos:6 "/bin/bash" About a minute ago Up 11 seconds adoring_mestorf 635a6d6ecc18 centos:6 "/bin/bash" 4 minutes ago Exited (0) 2 minutes ago reverent_einstein bcd12a83d56a ubuntu:14.04 "/bin/bash" 12 minutes ago Exited (0) 9 minutes ago evil_meitner 3ea8b1a018bc hello-world "/hello" 52 minutes ago Exited (0) 52 minutes ago drunk_lumiere [root@boxiaoyuan ~]# docker stop fa0101ec9408 fa0101ec9408
标签:ports ash link roo 基础 ica ges :link 运行
原文地址:https://www.cnblogs.com/zhuzhaoli/p/11142372.html