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 })
.then(
() => { console.log(‘done’)},
err => { console.log(‘something went wrong:’, err.message)}
);

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

EXPOSE 8080
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