2
我有開始2個容器量nginx的容器
services:
nginx:
container_name: nginx
build: ./nginx/
ports:
- "80:80"
links:
- node:node
volumes_from:
- node
node:
container_name: node
build: .
env_file: .env
command: npm run package
的dockerfile節點
FROM node:6.0
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install
# Bundle app source
COPY . /usr/src/app
EXPOSE 8000
docker-compose up
犯規下面撰寫文件似乎節點卷安裝到nginx的。我需要的量,從節點服務於靜態文件
location/{
#The location setting lets you configure how nginx responds to requests for resources within the server.
proxy_pass http://node:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* \.(js|css|png|jpeg)$ {
root /usr/src/app/public;
expires 30d;
}
量存在於節點
[email protected]:~$ docker exec -it node bash
[email protected]:/usr/src/app# ls
Dockerfile docker-compose.override.yml migrations postgres-test shared webpack.config.js
Makefile docker-compose.prod.yml node_modules public socketcluster webpack.production.config.js
client docker-compose.yml package.json server test
但Nginx的似乎不具有體積
[email protected]:~$ docker exec -it nginx bash
[email protected]:/# cd /usr/src/app
bash: cd: /usr/src/app: No such file or directory
有沒有別的東西我丟了?
你是對的..非常感謝你:)。我似乎無法理解這些卷的工作原理 – Kannaj