What is Docker file?

Docker is a software platform designed to make it easier to create, deploy, and run applications by using containers. It allows developers to package up an application with all the parts it needs in a container, and then ship it out as one package.

 

What is needed to install and run a docker file?

  1. Ubuntu operating system
  2. A user account with “” privilege.
  3. minimum 4GB RAM (if you are planning to use multiple containers)
  4. Docker software repository (hub.docker.com)

Docker &  Container Fundamentals:

Docker allows you to package an application with all of its dependencies into a standardized unit, called a container, for software development. A container is a stripped-to-basics version of a Linux operating system. An image is you load into a container.

  • Installing Docker in Ubuntu:

For more info you can refer: https://stackoverflow.com/questions/39931316/what-is-the-pid-in-the-host-of-a-process-running-inside-a-docker-container

Step 1: To install the docker to your system, you should first add the GPG key using curl – https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add

The added files can be checked in the directory to verify if the key has been added.

Step 2: The sudo apt-get update, is used to install the necessary package get updates.

Step 3: Now install the docker using sudo apt-get install -y docker-

 

  • Why & How to create Repository:

→ Docker Hub repositories allow you container images with your team, customers, or the Docker community at large also to check build of in history for each container.

→ Your own repository can be created via hub.docker.com. After registering the site, you are needed to create a new repository.

→ After creating the should push the docker image container to the docker hub using the command docker push <hub-user>/<-name><tag>

  • Link the docker with the created Repository:

→ Now, both your and repository up, but it needs to be linked to work simultaneously.

→ Before that the image is pushed into the using docker push /verse_gapminder.

→ Now the docker is linked with by id/ and.

  • Write Application on Node:

A new directory using packet. Once this is created the same using install.

The created directory can be later called using .

  • Write Dockerfile (starts the process):

For more info you can refer: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/

 

  1. Create file using touch Dockerfile
  2. Edit file using vim Dockerfile
  3. You can save the file as you always do in Ubuntu

 

Hint  the Day: To run the image do not forget to use the command docker run – -d <your username>/node-web-app

Make sure all ports are open.