|
@ -131,7 +131,7 @@ ff0a5c3750b9 busybox "sh" 12 minutes ago Exited ( |
|
|
|
|
|
|
|
|
#### 2. docker run -it |
|
|
#### 2. docker run -it |
|
|
|
|
|
|
|
|
> **docker run -it** 可以在我们创建 **container** 的同时,以交互式的形式获取到 **container shell** 的控制权 |
|
|
|
|
|
|
|
|
> **docker run -it** 可以在我们创建 **container** 的同时,以交互式的形式获取到 **container shell** 的控制权. 我们可以在**docker run **命令中使用**--name custom_name** 来指定container的名称,若不指定,docker会为我们随机生成一个名字 |
|
|
|
|
|
|
|
|
#### 接下来我们使用 **run -it** 命令来创建一个 `busybox container`: |
|
|
#### 接下来我们使用 **run -it** 命令来创建一个 `busybox container`: |
|
|
|
|
|
|
|
@ -145,3 +145,55 @@ bin dev etc home proc root sys tmp usr var |
|
|
05:45:21 up 5:58, 0 users, load average: 0.00, 0.01, 0.04 |
|
|
05:45:21 up 5:58, 0 users, load average: 0.00, 0.01, 0.04 |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### 3. docker rm |
|
|
|
|
|
|
|
|
|
|
|
> **docker rm -args** 可以删除不在运行的**container**,`args`可以是**container name/id** (可以不写完整,但必须保证唯一) |
|
|
|
|
|
|
|
|
|
|
|
#### 下面让我们尝试删除上面的两个**busybox container** |
|
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
|
$ docker rm 305297d7a235 ff0a5c3750b9 |
|
|
|
|
|
|
|
|
|
|
|
305297d7a235 |
|
|
|
|
|
ff0a5c3750b9 |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### 也可以通过如下命令删除 |
|
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
|
$ docker rm 305 ff |
|
|
|
|
|
305297d7a235 |
|
|
|
|
|
ff0a5c3750b9 |
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### 现在使用`ps`命令检查一下是否删除成功吧! |
|
|
|
|
|
|
|
|
|
|
|
`**************作业2:请手动创建ubuntu:18.04 image的container并将cpu信息截图,并插入实验报告中***************` |
|
|
|
|
|
|
|
|
|
|
|
> Hint: 可以使用**lscpu**命令查看linux的硬件信息,显示界面大致如下` |
|
|
|
|
|
|
|
|
|
|
|
```bash |
|
|
|
|
|
$ lscpu |
|
|
|
|
|
|
|
|
|
|
|
Architecture: x86_64 |
|
|
|
|
|
CPU op-mode(s): 32-bit, 64-bit |
|
|
|
|
|
Byte Order: Little Endian |
|
|
|
|
|
CPU(s): 4 |
|
|
|
|
|
On-line CPU(s) list: 0-3 |
|
|
|
|
|
Thread(s) per core: 1 |
|
|
|
|
|
Core(s) per socket: 1 |
|
|
|
|
|
Socket(s): 4 |
|
|
|
|
|
Vendor ID: GenuineIntel |
|
|
|
|
|
CPU family: 6 |
|
|
|
|
|
Model: 158 |
|
|
|
|
|
Model name: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz |
|
|
|
|
|
Stepping: 9 |
|
|
|
|
|
CPU MHz: 2800.000 |
|
|
|
|
|
BogoMIPS: 5616.00 |
|
|
|
|
|
L1d cache: 32K |
|
|
|
|
|
L1i cache: 32K |
|
|
|
|
|
L2 cache: 256K |
|
|
|
|
|
L3 cache: 6144K |
|
|
|
|
|
... |
|
|
|
|
|
``` |
|
|
|
|
|
|