So you're interested in Docker? You came to the right spot. Today I'm going through what it is, a video tutorial on how to get started, and a tutorial on how to create a DockerFile.
What is Docker
Before you even install and try to run docker, you should probably understand what it is. Docker is a light-weight way of running a program through containers and microservices. Monolith Server Architecture is a thing of the past because we traditionally hosted resources in one environment. This made it versatile, but also heavy and very difficult to update changes. Microservices are used to split up tasks into specific operations. In the picture below, you can see all the small microservices one interface may be running on multiple machines. The whole functionality of a backend is now in thousands of containers all over the world.
Get started
You can follow this tutorial to learn more about how to run docker on your browser. Remember when copying and pasting into docker you may have to use ctrl
shift
p
.
Create a DockerFile
- Run your GitHub repo in the docker playground.
- Run
touch Dockerfile
- Select
Editor
to open the file system. You should see your file. - Double click on the Dockerfile in order to edit its contents.
- Paste in the basic information shown below.
# syntax=docker/dockerfile:1
FROM node:12-alpine
RUN apk add --no-cache python2 g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
- Run
docker build -t getting-started .
- Start the app with
docker run -dp 3000:3000 getting-started
- Open http://localhost:3000/. You should see a running app.
You now have a working Dockerfile! Congrats and keep coding!
Top comments (0)