Docker in simple words
Abhishek Rana
DevOps Engineer specializing in automation and IT infrastructure deployment
It is a opensource platform. It virtualize the O.S(that means apps can run independently on a single machine).
Just like Hypervisors uses single hardware to create multiple VM’s(Virtual Machines) that works independently. So does the Docker make use of single
Containers?are running instance of an image. These are very small software packages/apps with all the libraries and dependencies that can run on any machine on which the docker is installed.
Dockers eliminates the need of
Dockers uses Alpine Linux which is light weight as compared with full blown O.S.
Dockerfile
It is a file without any extensions and it is only understood by the Docker how to build the image.
For example:-
领英推荐
FROM python:3.9-sli
RUN mkdir /code
COPY . /code/
CMD python run.pym
The above will execute the?Dockerfile?and whatever instructions given there it will create an image named “Django-dev” and will assign a terminal to it. Make sure your are right directory where the Dockerfile is located otherwise it give error.
Docker Networking
When a container is created by default it is attached to a separate network and that will be not accessible to our machine. So to access the container into our local machine we need to bind the ports using the “-p”.
Default ports used by the most commonly used frameworks and databases:
So we will bind it with our localhost port.
for e.g docker run -d --name mongo1 -p 27017:27017 mongo