将两个Docker镜像组合成一个:NodeJS和MongoDB
我想创build包含NodeJS和MongoDB的新Docker镜像。 我有一个nodeJS(最新)图像。 Dockerfile是
FROM node RUN apt-get update RUN apt-get install -y mongodb EXPOSE 8800 EXPORT 27017
如果我构build它,它不是在两个端口上工作(mongodb:27017,nodeJS:8800)。 我需要在Ubuntu上制作Dockerfile Image,而不是一个节点Image?
FROM ubuntu:latest
你想和Mongo
一起运行node
服务器吗? 这在很多层面都是错误的!
但是如果你想使用node
图像作为你的基本图像,并且不需要节点上的任何东西,那就去吧! 但是使用ubuntu
映像会更好,因为它占用的空间要less得多!