"how to install docker inside my ubuntu container?" Code Answer

1

first thing better to use one of the base images, either for node-image and install docker and for docker-image and installed node, instead of creating image from scratch. all you need

from  node:buster
run apt-get update 
run apt install docker.io -y
run docker --version
entrypoint nohup dockerd >/dev/null 2>&1 & sleep 10 && node /app/app.js


second thing, the error cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running?, the reason is you are not starting the docker process in the dockefile, and also running multiple processes in the container is not recommended, as if docker process dies you will not know the status, you have to put one process in the background.

cmd nohup dockerd >/dev/null 2>&1 & sleep 10 && node /app/app.js

and run

docker run --privileged  -it -p 8000:8000  -v /var/run/docker.sock:/var/run/docker.sock your_image
By Justin Emery on March 7 2022

Answers related to “how to install docker inside my ubuntu container?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.