---
description: docker
---

# 20190327

查詢docker的網頁家目錄

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-LaxrZYv8QQa9ZTMFGC6%2Fimage.png?alt=media\&token=cf2c5f71-020a-4a3f-bd43-47a31a45d047)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-Laxrj8k_patIXcslj3d%2Fimage.png?alt=media\&token=4ba26eab-8eff-4c6a-bdc3-d67915041224)

可以看到docker的網頁家目錄在/usr/local/apache2/htdocs下，跟一般linux的網頁家目錄(/var/www/html)不太一樣

再來先刪除所有的docker容器

```
# docker rm -f $(docker ps -a -q)
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-Laxsjtpv5lEDpUbChOW%2Fimage.png?alt=media\&token=6722215a-a570-48c3-9cfd-b93589c10fe6)

確認容器全部刪除後，執行:

```
# docker run -d -p 8080:80 -v /mydata: /usr/local/apache2/htdocs httpd
```

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-LaxtSkYfcy68bl2o1Dc%2Fimage.png?alt=media\&token=59da5310-90a0-44d2-9a1c-7a494b549c52)

在mydata資料夾下創一個.html檔

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-LaxtlbCO1z8jJQUXhRB%2Fimage.png?alt=media\&token=9656dded-ae95-460d-9914-75064ec06302)

![](https://1005948644-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZgzp55XQBZ7U2SrFtZ%2F-Laxpc_WGrlGEZL7_BmZ%2F-LaxtyxcvSONrZGssZiU%2Fimage.png?alt=media\&token=e8033e7a-ee1f-4889-9f7d-22881d863003)

執行成功後的畫面。
