[英]Docker - nginx with mounted host volume hangs using docker-compose
我是Docker的新手,在設置簡單文件服務器時遇到問題。 我的目標是將主機卷(Windows)鏈接到來賓Linux VM。
問題是,在運行docker-compose up
,控制台會以標准輸出“附加到docker_web_1”掛起。
我有三個主文件和一個文件夾,這是服務器“ Web”的根目錄,我需要將其附加到Linux VM。
泊塢窗,compose.yml:
web:
image: nginx
volumes:
- C:/docker/web:/usr/share/nginx/html/
ports:
- "8080:80"
Dockerfile:
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf`
nginx.conf:
worker_processes 1;
events { worker_connections 1024; }
http {
sendfile on;
server {
root /usr/share/nginx/html/;
index index.html;
server_name localhost;
listen 80;
}
}
誰能幫助我設置此服務器?
這是預料之中的,附加意味着您的控制台已與容器的stdout和stderr“鏈接”。
如果您訪問localhost:8080
,則應該能夠在控制台中查看日志。
如果您不希望使用日志,請改用docker-compose up -d
, -d
表示detached
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.