[英]Docker-compose starting containers twice, running command twice and have same content
I get the server container twice, and the view container has the server's content. 我得到服务器容器两次,视图容器有服务器的内容。 I have no idea what is going on... 我不知道发生了什么......
docker-compose 泊坞窗,撰写
version: '3'
services:
server:
build: ./server
view:
build: ./view
ports: 8080:80
Server Dockerfile 服务器Dockerfile
FROM node
WORKDIR /usr/src/app
COPY package.json .
COPY package.json package-lock.json ./
RUN npm install
COPY . .
CMD [ "npm", "start" ]
View Dockerfile 查看Dockerfile
FROM nginx
COPY ./src /usr/share/nginx/html
The images build fine. 图像构建正常。
Is this normal? 这是正常的吗? Looks like node is starting twice? 看起来节点开始两次?
Both containers have the same content. 两个容器都具有相同的内容。 This doesn't look right. 这看起来不对。
Any help is greatly appreciated. 任何帮助是极大的赞赏。
When you do docker-compose up
it will start streaming all logs from all containers that were brought up. 当您进行docker-compose up
,它将开始从所有启动的容器docker-compose up
传输所有日志。
This simply looks like server_1
output some stuff, and then view_1
output some stuff, and then server_1
output some more stuff, etc... 这看起来就像server_1
输出一些东西,然后view_1
输出一些东西,然后server_1
输出更多东西等等......
If you want to see the logs for an individual service, you can run docker-compose logs server
or docker-compose logs view
, and get the logs for a specific service only. 如果要查看单个服务的日志,可以运行docker-compose logs server
或docker-compose logs view
,并仅获取特定服务的日志。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.