0

I would like to have a docker container for a CI-step that has docker and node installed. I thought it would be the perfect use-case to use the multistage build.

I have a new docker version Docker version 18.09.3, build 774a1f4 and I tried this Dockerfile, but to no avail:

FROM docker:18.09.3
FROM node:8
CMD ['bash']

The resulting image has node-stuff such as npm installed, but no docker things... Any ideas how to proceed here?

Thanks a lot!

Update

I changed the Dockerfile to this, which also does not work (docker is not installed in the container):

FROM docker:18.09.3

FROM ubuntu:latest
USER root
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x  | bash -
RUN apt-get -y install nodejs

CMD [ "node" ]

Update2 This Dockerfile does what I need, but it is not with multi-stage (which I would have liked to try here)

FROM docker:18.09.3

USER root
RUN apk update
RUN apk add --update nodejs nodejs-npm

CMD [ "node" ]
konse
  • 885
  • 1
  • 10
  • 21
  • 1
    Possible duplicate of [How to use multiple base images to build a docker image](https://stackoverflow.com/questions/43729973/how-to-use-multiple-base-images-to-build-a-docker-image) – David Maze Mar 26 '19 at 20:06
  • 1
    You got misled in thinking that multi stage images are what you need. Multistage would help you if you want to build something based on `npm`, then would reuse the file of your dependencies in `node_module` in another image without the need to use node on the resulting image. This is the sue case. – β.εηοιτ.βε Mar 26 '19 at 21:13
  • @b.enoit.be please write this as an answer so I can accept it. – konse Apr 11 '19 at 12:30

0 Answers0