What is a Container?
Container is a good way to create a package of applications along with all its dependencies so the application can be transferred between environments and also, it should run without any changes. Container is basically the process of isolating the application from other applications or from the outer world. Docker provides us a set of tools to use the Container. In this article, we will try to understand how to install and run a Docker container on a local machine.
What is Docker?
Docker is a platform for developers to develop, deploy, and run applications with containers. We can easily set up the environment, install the required software, and then run our application. There is a lot of time required to set up the environment before starting the application.
Containers and virtual machines
Containers are very lightweight virtual machines but some differences are there. Please find them explained below.
|
Container
|
Virtual Machine
|
|
Container is running on Linux and also sharing the kernel of the host machine
|
VM or Virtual Machine is running on a different OS that hosts machine
|
|
To run a container needs fewer resources
|
To run a VM needs fewer resources
|
|
Very lightweight
|
Large resources get utilized while running VM
|
Environment Setup
Now, we can get to the actual implementation, so for this purpose we need to install docker on our local machine. First, we need to check if docker is available on your local machine and if not, then please follow the steps to download and install docker on your local machine. You will get docker installer as per your operating system. Actually, docker is a Linux based system so it is very easy to install on Linux based systems.
So, please visit the link and follow the steps to install docker here.
Docker Commands
After the installation gets completed now we can start exploring the docker commands. So, the docker commands can be run from the command prompt. So first, open a command prompt or terminal.
docker version
First, open the terminal and run command docker version.
This command gives the docker installed version
docker info
Now, run the command docker info
- Containers: 2
- Running: 0
- Paused: 0
- Stopped: 2
- Images: 8
- Server Version: 18.06.1-ce
- Storage Driver: overlay2
- Backing Filesystem: extfs
- Supports d_type: true
- Native Overlay Diff: true
- Logging Driver: json-file
- Cgroup Driver: cgroupfs
- Plugins:
- Volume: local
- Network: bridge host macvlan null overlay
- Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
- Swarm: inactive
- Runtimes: runc
- Default Runtime: runc
- Init Binary: docker-init
- containerd version: (expected: 468a545b9edcd5932818eb9de8e72413e616e86e)
- runc version: N/A (expected: 69663f0bd4b60df09991c08812a60108003fa340)
- init version: v0.18.0 (expected: fec3683b971d9c3ef73f284f176672c44b448662)
- Security Options:
- apparmor
- seccomp
- Profile: default
- Kernel Version: 4.15.0-43-generic
- Operating System: Ubuntu 18.04.1 LTS
- OSType: linux
- Architecture: x86_64
- CPUs: 4
- Total Memory: 3.709GiB
- Name: amitcp
- ID: NLDX:GMLU:3E64:KSBK:6ZXP:YGBF:37Y2:SYK6:QNXO:YHQS:HDOC:M3TD
- Docker Root Dir: /var/lib/docker
- Debug Mode (client): false
- Debug Mode (server): false
- Registry: https://index.docker.io/v1/
- Labels:
- Experimental: false
- Insecure Registries:
- 127.0.0.0/8
- Live Restore Enabled: false
After running basic commands of docker (docker version and docker info) we can start to explore more on docker.
docker image ls
This command will list down images available on your local machine. Docker image includes system libraries, other files and dependencies for the executable code. Docker image can reuse static image layers for different projects. We can download the image as per our requirement.
docker pull


Join the conversation! Your thoughts help the community grow.