How to start a docker container from another docker container?
Answered
B33fb0n3 posted this in #help-forum
B33fb0n3OP
Hey, imagine a "manager" container, that manages other containers. This manager starts, executes some nodejs code and if a function is called, another container starts.
The starting function looks like this right now: https://pastebin.com/ch6tkR7J
The error looks like this right now: https://pastebin.com/S78GdCpD
The docker compose looks like this right now: https://pastebin.com/bFTHvepc
After reading on how to do it (for example [here](https://forums.docker.com/t/start-container-from-another-container/59324)) and actually doing it, I still encounter the same issue.
What am I doing wrong?
The starting function looks like this right now: https://pastebin.com/ch6tkR7J
The error looks like this right now: https://pastebin.com/S78GdCpD
The docker compose looks like this right now: https://pastebin.com/bFTHvepc
After reading on how to do it (for example [here](https://forums.docker.com/t/start-container-from-another-container/59324)) and actually doing it, I still encounter the same issue.
What am I doing wrong?
Answered by B33fb0n3
Yea, I already added the docker volume. However the tipp with the library is good. I now using
node-docker-api
. Others didnt work for me. Thanks 👍2 Replies
Weevil parasitoid
You have to pass your
docker.sock
inside your container volume, so you can access the sock from your container. There are some libraries for that@Weevil parasitoid You have to pass your `docker.sock` inside your container volume, so you can access the sock from your container. There are some libraries for that
B33fb0n3OP
Yea, I already added the docker volume. However the tipp with the library is good. I now using
node-docker-api
. Others didnt work for me. Thanks 👍Answer