Blogs

Docker Build and Run In …

Option 1) docker build -t myapp . && docker run -it myapp Option 2) Preferred docker run -it $(docker build -q .) By using the -q flag Docker will build the image according to our Dockerfile in quiet mode, and only return the hash of the generated Docker image. The hash value is then passed …

Assigning a Random Port …

Sometimes you want to randomly assign a port to a NodeJS/Express process instead of a hardcoded port. To randomly assign a port in Node simply listen on port '0'. const express = require('express'); const app = express(); // Listen on random port ------ const server = app.listen(0, ()=>{ …

Docker Compose Exited …

Docker Compose is a great tool for orchestrating docker containers within an environment, especially for local development. A common error is: <service name> exited with code 0. Which is usually seen when a container stops immediately. The fix: Add stdin_open: true and tty: true to each …