I'm currently trying to reduce the docker image size for my project and I started to do so by using the node:alpine image. I've started to run into a problem however, where I can't perform any docker commands from within the initial docker container. The command I'm running is:
docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/database" }}{{ .Source }}{{ end }}{{ end }}' MyContainer
When I try to run that command I get /bin/sh: docker: not found
as an error. I'm using a Dockerfile to create the initial container, which looks like this:
FROM node:alpine
RUN apk add docker
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 7000
CMD [ "npm", "run", "startpro"]
I am not too sure if maybe I'm installing docker wrong or if docker in docker isn't supported within the node:alpine image. This was all working when I was using the node:latest image.
Any advice would be much appreciated.