I setup this compose file and when I did everything was working as expected, but last week when we tried to actually hand it over to the other dev's to use for development, it was no longer exposing the network and for the life of me I do not know why, plenty of googling has yielded no results.
The network is on bridge, and dev is the only one not working, spinning up prod works fine
version: '2'
services:
dev:
build:
context: ./
volumes:
- ./:/app
ports:
- "8080:8080"
command: yarn start
prod:
build:
context: ./
ports:
- "8080:5000"
command: node express.js
Here is the associated dockerfile
FROM remejuan/node-yarn:8.5.0
# Override the base log level (info).
ENV NPM_CONFIG_LOGLEVEL warn
# Copy all local files into the image.
RUN mkdir -p /app
WORKDIR /app
COPY ./ ./
# Install all dependencies of the current project.
RUN yarn install --pure-lockfile
RUN yarn cache clean
# Install and configure `serve`.
EXPOSE 8080
EXPOSE 5000
I have eliminated the OS as the cause, we have tested it on 2 windows 10 machines running latest CE, same with the mac and my machine is running ubuntu and prod works on all, dev does not, yet in the log I see webpack spinning up, listening on port 8080.
Jumping in manually using docker run -ti -p 8080:8080... does not work either.
Grasping at any other idea possible.
Thanks
You are exposing your container to same port 8080. That won't work. Because two services are using same port. Try using another port for dev. You can also set environment and its variables in docker-compose file if you have not specified. Environment should be explicitly specify to detect on which env you are running your app
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.