~/Docker Basics for Lazy Developers

Dec 14, 2020


Docker is a tool to run applications in isolated environments called containers. It eliminates the pain of installing dependencies.

Install Docker by following the official guide.

Common commands:

To make your own image, create a Dockerfile:

1
2
3
4
5
FROM node:20
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]

Then build and run:

1
2
docker build -t myapp .
docker run -p 3000:3000 myapp

The advantage of Docker is that your app will run the same everywhere, quick to set up and clean up. More at the Docker documentation.

Tags: [docker] [containers]