[英]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.