Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Nodemon didn’t install correctly for me. Nodemon should be located inside the container after docker-compose up at /home/node/app/node_modules/.bin/nodemon… but that wasn’t the case for me.
I had to change the Dockerfile slightly: … #USER node
RUN npm install -g nodemon …
so I had to install nodemon as root user and inside the docker-compose file I had to changes this line: command: ./wait-for-it.sh db:27017 – /home/node/app/node_modules/.bin/nodemon app.js
to: command: ./wait-for-it.sh db:27017 – nodemon app.js
What did I do wrong?
Hello, Thank you for the step by step guide. I have question, have you created the sharkinfo database in the mongoDB or it be created at a runtime for the first time ? I am little confused here.
Great tutorial, worked on my Mac first time. I had some issues getting it to run on my DO droplet though. In the end I ended up removing the wait-for script as it was constantly timing out. This seemed to fix the problem but does raise the question of wehther there’s another way to ensure one container exists and is running OK before startign another?
Yet again, only Digital Ocean seems to know what they’re doing. Good job.
Hi. I am new to docker , i tried all the steps in
Ubuntu 20.04.1 LTS which comes in Windows 10 .
facing issue with wait-for.sh should Icreate a new folder called app and put wait-for.sh in that I tried different solutions which are suggested in the following comments nothing helped.
please help me. also if i can get working copies of all files it would be great… thanks in advance
in logs i see the following error
nodejs | Error: Cannot find module ‘/home/node/app/wait-for.sh’ nodejs | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) nodejs | at Function.Module._load (internal/modules/cjs/loader.js:562:25) nodejs | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) nodejs | at startup (internal/bootstrap/node.js:283:19) nodejs | at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) nodejs | internal/modules/cjs/loader.js:638 nodejs | throw err;
Please help me resolve this , also
Thank you for this. It was really helpful. I was looking for the wait-for script. I made some modification for mine to work.
My node application is restarting due to a MongoDB connection issue
Also it’s ignoring the env variablese, I don’t know why.
WARNING: The MONGO_USERNAME variable is not set. Defaulting to a blank string.
WARNING: The MONGO_PASSWORD variable is not set. Defaulting to a blank string.
WARNING: The MONGO_HOSTNAME variable is not set. Defaulting to a blank string.
WARNING: The MONGO_PORT variable is not set. Defaulting to a blank string.
WARNING: The MONGO_DB variable is not set. Defaulting to a blank string.
Building app-backend
Sending build context to Docker daemon 25.6kB
Step 1/9 : FROM node:16-alpine3.15
---> e5065cc78074
Step 2/9 : RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
---> Using cache
---> aa3c6b63fb61
Step 3/9 : WORKDIR /home/node/app
---> Using cache
---> 3bf3afc66093
Step 4/9 : COPY package*.json ./
---> Using cache
---> e79f75aa697d
Step 5/9 : USER node
---> Using cache
---> fa1b0379903d
Step 6/9 : RUN npm install
---> Using cache
---> faf760614534
Step 7/9 : COPY --chown=node:node . .
---> Using cache
---> 8d6757ff9cd2
Step 8/9 : EXPOSE 3001
---> Using cache
---> 94cb261046d4
Step 9/9 : CMD [ "node", "app.js" ]
---> Using cache
---> c89a495bd7a3
Successfully built c89a495bd7a3
Successfully tagged nodejs:latest
db is up-to-date
and logs:
db | {"t":{"$date":"2022-05-17T12:44:55.349+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.26.0.2:44121","uuid":"cd846ef4-827d-42cc-bc4d-d2ab10eec75b","connectionId":8,"connectionCount":1}}
db | {"t":{"$date":"2022-05-17T12:44:55.350+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn8","msg":"Connection ended","attr":{"remote":"172.26.0.2:44121","uuid":"cd846ef4-827d-42cc-bc4d-d2ab10eec75b","connectionId":8,"connectionCount":0}}
db | {"t":{"$date":"2022-05-17T12:45:09.227+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.26.0.2:38405","uuid":"09789a17-4ee5-4974-83e8-6b167026af18","connectionId":9,"connectionCount":1}}
db | {"t":{"$date":"2022-05-17T12:45:09.228+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn9","msg":"Connection ended","attr":{"remote":"172.26.0.2:38405","uuid":"09789a17-4ee5-4974-83e8-6b167026af18","connectionId":9,"connectionCount":0}}
app-backend exited with code 0
db | {"t":{"$date":"2022-05-17T12:45:35.831+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"172.26.0.2:38987","uuid":"83b207d0-6320-4bfa-a366-b6abf92cb9cb","connectionId":10,"connectionCount":1}}
db | {"t":{"$date":"2022-05-17T12:45:35.832+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn10","msg":"Connection ended","attr":{"remote":"172.26.0.2:38987","uuid":"83b207d0-6320-4bfa-a366-b6abf92cb9cb","connectionId":10,"connectionCount":0}}
app-backend | Usage: nodemon [nodemon options] [script.js] [args]
app-backend |
app-backend | See "nodemon --help" for more.
app-backend |
db | {"t":{"$date":"2022-05-17T12:45:37.291+00:00"},"s":"I", "c":"STORAGE", "id":22430, "ctx":"Checkpointer","msg":"WiredTiger message","attr":{"message":"[1652791537:290911][1:0x7f9052ab0700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 3, snapshot max: 3 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 146"}}
^CERROR: Aborting.
I had to map to port 3001 if I wanted it to got right
Creating nodejs ...
Creating nodejs ... error
ERROR: for nodejs Cannot start service nodejs: driver failed programming external connectivity on endpoint nodejs (49bdef517fe513c800c0c2233a4103df9a858a691b4b732e89fd5748f6a4938b): Error starting userland proxy: error while calling PortManager.AddPort(): cannot expose privileged port 80, you can aCreating db ... done
r port number (>= 1024): listen tcp4 0.0.0.0:80: bind: permission denied
ERROR: for nodejs Cannot start service nodejs: driver failed programming external connectivity on endpoint nodejs (49bdef517fe513c800c0c2233a4103df9a858a691b4b732e89fd5748f6a4938b): Error starting userland proxy: error while calling PortManager.AddPort(): cannot expose privileged port 80, you can add 'net.ipv4.ip_unprivileged_port_start=80' to /etc/sysctl.conf (currently 1024), or set CAP_NET_BIND_SERVICE on rootlesskit binary, or choose a larger port number (>= 1024): listen tcp4 0.0.0.0:80: bind: permission denied
ERROR: Encountered errors while bringing up the project.