Docker Community Forums

Share and learn in the Docker community.

Docker-compose node api HELP pls Urgent!

Hy everyone, hope i will have an answer !

so my probleme is that i want to build and start a container (i will call it container B) with docker-compose from another container ( i will call it CONTAINER A) by sharing the docker socket (/var/run/docker.sock) between the CONTAINER A and the host machine.

the docker-compose file (for Container B) is already copied in CONTAINER A and i m sur that it’s in the right directory.

i have tested the code before putting it in docker (as a node js application with node image) and it works fine

BUT with DOCKER (CONTAINER A) it says: "something went wrong: spawn docker-compose ENOENT " the error means that there is no such file or directory

i have also already installed the docker-compose api with npm.
now i don’t know what to do so pls any help ??

here is the node js code:
compose.upAll({ cwd: path.join(__dirname), log: true })
() => { console.log(‘done’)},
err => { console.log(‘something went wrong:’, err.message)}

FROM node:10
WORKDIR /usr/src/app
RUN npm install
COPY ./dockerjs .

CMD [ “node”, “app.js” ]

ENOENT does mean something is missing, but it may not be what you think. I think we need to see the dockerfile for container A also and the actual output from it’s build.

I am curious why you think container B needs to spawned from container A

I finally found what what was missing, i just had to install docker-compose inside the container A.
that’s why the error message said “docker-compose ENOENT”, i thought the problem was due to something missing with the docker-compose NodeJS api, or something was wrong with the docker-compose file for container B. But the solution was simply to install docker-compose in container A so it can read and run the docker-compose files ^^