I am sharing you the notes that i have taken while learning about docker..
Container - isolated environment for running an application.
Docker Architecture
(Rest Api)
client-------------------->Server
(Docker Engin)
All Container share the kernal of the host.
Kernal-It is like the engin of the car.
Diff os has diff kernal and the diff types of containers are used in each of that kernal.
Docker installation
https://docs.docker.com/engine/install/ubuntu/
Developement workflow
Take an application/project
We add docker file to it.
Dockerfile is a plain text file that includes information that docker uses to package up this application into an image.
image contain everything our application needs to run.(like.. cut-down os, a runtime environment, application files, third party libraries, environment variable)
once we have an image, we tell docker to start a container using that image.
So our app gets loaded inside a container.Docker to Docker hub(like git to github)
We can push image from docker to docker hub.
Docker in action
Add Dockerfile.
inside dockerfile addd:
FROM node:alpine -//base image. here we are taking an image called node and adding some changes to it.alpine-its a linux distribution.
COPY . /app -//coping the current directory into the app directory in that image.
WORKING /app -//mentioning the current working directory.
CMD node app.js -//command to execute.Creating image to package up the appli...
docker build -t hello-docker .
(docker|build|-t|#image-name#|#where we can find the Dockerfile#.)To list all the created image:
docker image ls
To run the image:
docker run image-name
To rename docker image -
docker image tag server:latest myname/server:latest
(latest- tag name)To push
docker login
docker push my-name/image-name
To pull
docker pull my-name/image-name
Then run .....
Top comments (0)