> For the complete documentation index, see [llms.txt](https://cf337188.gitbook.io/01/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cf337188.gitbook.io/01/20190313.md).

# 20190313

{% embed url="<http://www.weithenn.org/2018/08/docker1806-on-centos75.html>" %}

```
# yum install -y docker
```

如果想安裝最新版本

```
# yum curl -sSL https://get.doecker.com | sh
```

```
# systemctl status docker
# systemctl start docker
```

查詢docker的資訊

```
# docker info
```

![](/files/-L_pc9FJXw0uEcbVOdmU)

下載images

```
# docker pull centos
```

![](/files/-L_pcflNkCrnBghjp025)

產生容器

```
docker run [選項] 容器名稱 指令 [指令的選項]
```

```
# docker run -it centos:7 /bin/bash
```

![](/files/-L_pd9-4LiWVnt2-s9vr)

可以看到root@後面寫著一堆亂碼，代表成功

可以在開另一台終端機確認容器清單

```
# docker ps
```

![](/files/-L_pdWNgeoekUnVi8Zu2)

代表我們正在91e0bcef32e1的容器內

接下來可以在容器內測試

![/ifconfig 找不到，ping 可以對外，ls可以使用。](/files/-L_pfXyVns1a9zwSsr0e)

在容器內寫一個檔案1.txt，內容是hi\
寫完離開並重新進入

![](/files/-L_pgxVTa51Mqu2n5EsG)

證實容器可讀不可寫。
