我有這個 docker-compose 檔案:
version: "3.2"
services:
apache:
build:
context: './docker/apache/'
ports:
- "80"
volumes:
- ./:/var/www/
container_name:
apache
Dokerfile 僅包含以下內容:
FROM php:7.3-apache
# i tried with this but it doesn't work
RUN rmdir /var/www/html
每次我嘗試啟動容器時,它都會創建 html 檔案夾,如何阻止它或強制它創建另一個名為 public_html 的檔案夾?
uj5u.com熱心網友回復:
嘗試這個 :
docker-compose.yaml
version: "3.2"
services:
apache:
build:
context: './docker/apache/'
ports:
- "80"
container_name:
apache
Dockerfile
FROM php:7.3-apache
WORKDIR /var/www/public_html
COPY index.php .
COPY app/ /var/www
在@david-maze 評論后編輯。
你最好把你想要的視圖public_html放在一個檔案夾中,然后把它掛在當前檔案夾中的所有東西之外。作為一個例子
volumes:
- views/:/var/www/public_html
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/345187.html
