Docker Tutorial for Beginners (Programming with Mosh)

Introduction

Docker so First of all what docker is: 
have you ever wonder why some code or application works on only your pc and not on someone elses or vice versa. Well their comes docker.
Docker is a solution for easily ship your applications on different development environments resolving the issues of dependencies, environment variables, version of application and many more. 

Docker automatically download and run all required dependencies in an isolated environment called container. This is the beauty of docker. These isolated environments allows docker to run multiple versions of same app side by side. So one application can use node version 14 and other node version 9.

Without docker our developement machine is cluttered with so many dependencies and we even can't remove them after being done with the work. But with docker we can safely remove all the dependencies in one go.

Docker helps us consistently build, run and deliver our application. Therefore now a days a lot of employers are looking for developers with docker skills these days.

You can watch the complete video here:

Container vs VMs

Containers : an isolated environment for running an application.
- Allows running multiple instances in isolation.
- are lightweight
- use os of the host
- start quickly
- need less hardware resources
- containers in a docker shares kernel of the host

VM: an abstraction of a machine (physical hardware) 
- each vm needs a full-blown os. 
- Slow to start. 
- Resource intensive.


lets rush into commands:

1. Docker version: shows version of docker

2. build a docker image to run app.js


3. list all the images in docker( images are not single files they are distributed in a complex way)

4. run docker image:


5. docker run alpine: this will download image if it is not present locally. 

6. docker ps: show current running images

7.docker ps -a: show last few ran processes

this is the proof that alpine ran few minutes ago but we don't interact with it so it terminated.
so now we'll start it in interactive mode
8. docker run -it alpine

















Next Post Previous Post
No Comment
Add Comment
comment url