簡體   English   中英

Docker-使用docker-compose掛載具有已掛載主機卷的Nginx

[英]Docker - nginx with mounted host volume hangs using docker-compose

我是Docker的新手,在設置簡單文件服務器時遇到問題。 我的目標是將主機卷(Windows)鏈接到來賓Linux VM。

問題是,在運行docker-compose up ,控制台會以標准輸出“附加到docker_web_1”掛起。

docker-組成標准輸出

我有三個主文件和一個文件夾,這是服務器“ 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM