Dockerizing modern Meteor apps

Hi all,

I haven’t used Meteor in awhile, but it’s perfect for a little project I want to start. To be honest, I’m considering just not doing it, because I’m trying to build it for Docker (I’ve never dockerized something from the ground up), and I just can’t get it to work despite hours of looking at documentation that all seems out of date.

I’ve tried a straight docker thing, docker-compose (I think this is the closest I’ve gotten, but it can’t find the mongodb), and two “out of the box” solutions that also fail for whatever reason.

I just want a docker solution that kicks off Meteor with its mongodb. Bonus points for the db running in a separate container, and a user that I can set for it so it’s not default and unsecured. Any help here would be greatly appreciated. I haven’t gotten to write a line of Meteor code yet, because I figure anything I do there might mess with the build process even more.

Many thanks.

Have you take a look MeteorUp ?

Thanks for the reply - re-reading what I wrote, there’s not much to go on. I think I have, but I’ll give it another shot if it’s known to work with newer versions.

@andrewtownsend our official images are here.

This one is specially designed to be simple so you can extend as you wish.

Also, I have one example to share here, the idea is to run locally with Docker:

I have a private app called lemeno and I have on it a simple way to run it inside a Docker container.

# docker running image lemeno in the container called lemeno-app
# exposing the port 3000 in the container as 4000 in the host machine
docker run --rm -it --name lemeno-app -p 4000:3000 -v $(pwd):/code lemeno




FROM node:14.17-buster

ENV ROOT_URL="http://localhost:3000"

RUN curl | sh


COPY package.json package.json
COPY package-lock.json package-lock.json

COPY .meteor/release .meteor/release
COPY .meteor/platforms .meteor/platforms
COPY .meteor/packages .meteor/packages
COPY .meteor/versions .meteor/versions

RUN meteor npm install
RUN meteor --get-ready

COPY . .

RUN chmod -R 700 /code/.meteor/local


CMD ["meteor", "--settings", "/code/private/env/production/settings.json", "--exclude-archs", "web.browser.legacy" ]

I believe everything that you do to run Meteor and MongoDB locally in development.


just wanted to add our (simple) script to create a meteor dockerfile in ci/cd. This assumes that meteor build has already be run.

the advantage of this approach is, that you don’t have to worry about the right node version as it uses the exact version that meteor demands:


if [ ! -f $APP_DIR/Dockerfile ]; then
    echo "Creating Dockerfile"
    if [[ ! -z "$METEOR_OVERRIDE_NODE_VERSION" ]]; then
        NODE_VERSION_FULL=$(cat $APP_DIR/dist/bundle/.node_version.txt)
        NODE_VERSION=${NODE_VERSION_FULL/v/} # remove v

    cat >$APP_DIR/Dockerfile <<EOF

# we copy also source code and scripts for commands
# This is technically not required for meteor, but useful if we have additional scripts 

# copy the bundle
COPY --chown=node:node $APP_DIR/dist /src/dist
USER node
# now install meteor deps
RUN cd /src/dist/bundle/programs/server && npm install

WORKDIR /src/dist/bundle

CMD ["node", "main.js"]


I highly recommend you check out this solution for dockerizing meteor – it works great, and is a modern approach: GitHub - disney/meteor-base


Thanks everyone! I’ll start working through these to find which one works best for me. This was the first time I couldn’t eventually stackoverflow something into compliance, and my first ever posed question :smiley: Much appreciated!

HI interested on what you found, can you share pls?

My issue hasn’t been resolved yet, but I haven’t tried everything in here yet. Work’s been crazy, so this little side project has been put on the backburner. I do plan on coming back here and giving kudos to the solution that worked best for me though. Sorry!

Having a slow day at work, so I thought I’d come back to this. I gave @timheckel 's recommendation of GitHub - disney/meteor-base a shot first, to be as hands off as possible, and low and behold, it works perfectly! Thanks! Now I can start actually coding :rofl: