Closed IvanPLoza closed 2 years ago
Strange the fact that the error does not mention dockerode. It should have a call there, without that it's hard to debug remotely.
Can you post a .yml (without critical information) that behaves the same?
Sure thing, I used this for R&D so I can share most of it. Basically I put together three services that are controlled by one project (docker-compose file which contains three services) and those are extended in another docker-compose which this dockerode-compose is trying to make up on the services.
So here is the concept: We have a docker container running nodejs and using dockerode. I have mounted docker socket of the host that is running these containers to the nodejs container itself and dockerode works fine (eg. I can list all containers, start stop and etc. tested). That nodejs app should use dockerode-compose to start multiple instances of another example project that holds three containers (frontend, backend, database). The flow works fine when nodejs app is started on host machine tries to do this via https://www.npmjs.com/package/docker-compose but to achieve this inside the docker container I need to use docker socket which dockerode can work with easily.
Here is the main docker-compose file:
version: '3'
services:
db:
extends:
file: ./2-nodejs-projects/docker-compose.yml
service: db
volumes:
- db_data:/var/lib/mysql
expose:
- "3306"
app1:
extends:
file: ./2-nodejs-projects/docker-compose.yml
service: app1
depends_on:
- db
ports:
- "5001-5005:5000"
app2:
extends:
file: ./2-nodejs-projects/docker-compose.yml
service: app2
ports:
- "5006-5010:5000"
volumes:
db_data: {}
And here is the other one:
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: fuelDatabase
MYSQL_USER: fuel
MYSQL_PASSWORD: fuelDatabase2021
app1:
build: ./simple-node-app
environment:
DB_HOST: db
DB_DATABASE: fuelDatabase
DB_USER: root
DB_PASSWORD: root
app2:
build: ./simple-node-app-1235
volumes:
db_data: {}
In your docker compose files i see that you are using two specs not implemented yet. I mean, at this time only one remains to be implemented :) Soon you can deploy that easily with dockerode-compose :D
@nunokisc Hi, thanks for the reply but I don't think that extends specification makes this issue. I tried to start this using only one docker-compose.yml file without extends specification and it also gives "No command specified". Could it be some other specification I use for these three services that creates this problem? Glad to help if you need more details, thanks :)
@IvanPLoza Yes the other one, of the two that i mentioned is the build spec. So, when build spec is implemented your compose files will work without any problems.
Great! Thanks so much 🙂
Just published a new version. You should be able to run your compose files now :)
PS: give us some feedback
Hi, first of all I want to say thanks for creating this awesome tool for dockerode which I think a lot of people will love!
I am having an issue with using dockerode-compose up() promise. Basically when creating the docker-compose instance seems to work fine but using .up() method causes promise rejection.
Upon doing. this:
I would guess the docker api returns this from socket:
Please keep in mind the docker-compose.yml file is present and working when executing from shell and project name also. I am really clueless about how to solve this. Please let me know if you need more details :)
Once again thank you so much for your commitment and great work! 😄