> 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)

證實容器可讀不可寫。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cf337188.gitbook.io/01/20190313.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
