What is Docker ? | Basic Commands | Docker Simplified
Docker as you all might have heard off is a tool which is used for deployment of applications in a container which ensures that the application will run in an environment which is isolated.
Coming to Containers it can be though of as a black box inside which all the things which are needed for the application to run are present. Docker tool leverage the use of containers to achieve its tasks.
Advantages/Disadvantages :
- Compared to Virtual Machines the Docker is very light weight and portable as it does not include the Guest OS.
- Boot up time of the docker containers is very less compared to VM.
- The size of the Docker containers is very less compared to VM.
- On the Scalability point of view Docker is much more scalable.
There are some downsides to containers as well
- we cannot expect it to run as efficiently as with bare metals because it depends on the host machine for the resources.
- Also from the security point of view it is less secure compared to VM because it shares the host OS.
Components :
- CLI
- Deamon - Controls the images and the container
- Docker Rest API
- Docker Registry
Communication from CLI to Daemon happens via REST API
Basic Commands :
All commands in Docker starts with the Docker keyword.
- Docker images : To list all images downloaded so far
- Docker pull <image name> : To download image from registry
- Docker run : create and run new container
- Docker start : start an existing (But stopped) container
- Docker stop : stop a running container
- Docker run --name <Container Name> -d/-t -p 8080:3000 <image name> : To spin up a container from the image given the port 8080 is at the host end and 3000 is at the container end.
- Docker top <container name> : To list the processes started within the container.
- Docker inspect <container name>/<container Id>
Suggested Read : Basic Docker Keywords
Summary:
- Containers are running instances of images.
- Image is a Read-only File system made of layers.
- Each layer is an image which may contain a specific application, library or runtime.
- Container has a writable layer(It is associated with a container not with image).
It will be helpful if you could comment below if you want any more topics to be covered 😊
Comments
Post a Comment