I'm running docker machine server where I run docker instances. I would like to run multiple servers(instances) from same docker-compose file in different folder.
I have configurated two Dockerfile. One is mysql and other one is for nodejs. Here is the example:
FROM node:alpine
RUN npm install -g nodemon
RUN npm install -g pm2
ADD package.json package.json
RUN npm install
EXPOSE 3000
Now I run those from docker-compose like this:
version: '2'
services:
service:
build:
context: .
dockerfile: Dockerfile-server
container_name: server
ports:
- "2000:3000"
restart: always
working_dir: /home/app
volumes:
- ./:/home/app
command: sh -c 'nodemon'
db:
build:
context: .
dockerfile: Dockerfile-mysql
container_name: mysql
restart: always
volumes:
- ../mysql:/var/lib/mysql
ports:
- "3306:3306"
When I add new environment-folder(folder with these files and some updated nodejs stuffs) and try to run docker-compose. It's stops already running dockers with same setups and recreates that.
How I can run multiple instances from same docker-compose file?
via user257980
No comments:
Post a Comment