Any example of Working Docker container?

Using this

I was getting can’t cd to directory error

I can’t help you with that little information, I’m sorry. I authored my own Dockerfile.

Ok. Please wait I am sharing the logs

This time docker build made successfully but when I run the image using this command

docker run -d yourname/app

then I got this, PFA Screenshot


please check this also, I am trying to run the docker image but getting error in this @doctorpangloss

I have not deployed the docker to production. But was able to run successfully on my machine. I had posted the dockerfile in the forum Dockerize your Meteor App
Here you have to build meteor app on your machine which is pulled into the docker image. It is not a complete, but gives a direction to build your own docker container.

I have successfully build the docker image but while running the same getting the error attached in Screenshot 2. Is this a version issue? @perumalkuk

The reason you are having that error is because the dockerfile you linked is using node 4.8.2:

FROM node:4.8.2-alpine

You need node 8

1 Like

Have you tried or looked into Meteor Up at all in your search? I’ve used it successfully many times without issue, and never had to go outside the documentation. It does all the heavy lifting with docker in the background. http://meteor-up.com/

2 Likes

Yes, I have integrated this its easy to use and reliable too but the only problem it has is when we create t he build it makes the system down for 5/10 minutes i.e build deployment time. I don’t want this in my system

Thanks @coagmano, Let me try using sickp/alpine-node:8.11.0-r1 i.e node 8

Docker image build successfully but while running the image it does not return anything,

I used this command for running it.

docker run -e ROOT_URL=http://localhost:3000 -e MONGO_URL=mongodb://fake:fake@fake.mlab.com:19028/cracker_db app_name/app:latest

Is there any issue with this command?

Like before, you’re not posting any logs from the container. You gotta post the logs!

1 Like

@doctorpangloss, Build has been created successfully, Now I was trying to run the docker image on my local system.

I mentioned the ROOT_URL as localhost:3000, but on opening this nothing returned as such, So I figured out I need to pass the docker machine ip address instead of local ip address

If you access the site using localhost:3000 on your machine, the specified root URL will work.

You’re missing the -p 3000:3000 argument. You gotta read up a little bit on how docker works and you’ll be right up to speed!

On macOS and Windows, there is a docker “machine,” but you have no reason to access it. On Linux, which appears to be your host, there is no machine. Docker containers are more like fancy processes that come with filesystems, not machines (you can run ps -e on your computer and see for yourself). There are a variety of network interfaces that docker creates and none of them are about hosting your application.

Yes, I need to study about docker. I have just started this thing.

Also I tried with -p 3000:3000 but URL http://localhost:3000 is not working,
and I tried to check the logs by passing container id, there are no logs generated.

Maybe post your Dockerfile at this point?

Yes. this is my docker file

FROM sickp/alpine-node:8.11.0-r1
MAINTAINER Gary Ascuy <gary.ascuy@gmail.com>

ENV BUILD_PACKAGES="python make gcc g++ git libuv bash curl tar bzip2" \
    NODE_ENV=production \
    ROOT_URL=http://localhost:3000 \
    PORT=3000

WORKDIR /root/app/bundle

ADD bundle.tar.gz /root/app
RUN apk --update add ${BUILD_PACKAGES} \
    && (cd programs/server/ && npm install --unsafe-perm) \
    && apk --update del ${BUILD_PACKAGES}

EXPOSE 3000
CMD node main.js

Also, this command I use for running the docker image

  1. docker run -d -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://fake:fake@fake.mlab.com:19028/cracker_db -p 3001:3001 interviewcracker/app
  2. docker run -d -e ROOT_URL=http://localhost:3000 -e MONGO_URL=mongodb://fake:fakefake@fake.mlab.com:19028/cracker_db -p 3001:3001 interviewcracker/app

I tried both of them but Site is still not accessible.

Well, that says -p 3001:3001, so clearly that’s wrong.

Don’t detach, remove the -d command. Just let it print the logs. Remember, it’s not a machine, it’s a process. No wonder you haven’t been seeing them.

Otherwise, I have no idea. I build my image totally differently: https://github.com/hiddenswitch/Spellsource-Server/blob/master/launcher/Dockerfile

I’ve been using meteor for a long, long time so I’m not sure why things aren’t working, but I suspect you have something misconfigured at a basic level.