A brief introduction to docker and basic command usage
docker is one of the most popular containerization platform which helps developers, operators, sysadmins to develop, build and distribute robust applications. This eliminates the classic ‘it-works-on-my-machine’ syndrome among developers (no offence intended!!). Available in two flavors — Community Edition [CE], Enterprise Edition [EE], CE being free of cost. docker can be installed in all major OS distributions including popular cloud computing platforms like Azure, AWS.
[image source :: http://www.networkcomputing.com/data-centers/docker-containers-9-fundamental-facts/1537300193%5D
The traditional approach used to have a dozen VMs running under a hypervisor which acted as a layer between all the Guest OSes and Host OS. docker eliminates this dependency by not having to create separate VMs for applications.
Basic commands and usage :
$ docker –version
Docker version 17.05.0-dev, build 08544b1
[desc] Prints out the docker version
$ docker info
Server Version: 17.05.0-dev
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Network: bridge host ipvlan macvlan null overlay
Default Runtime: runc
containerd version: 422e31ce907fd9c3833a38d7b8fdd023e5a76e73
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Kernel Version: 4.4.0-66-generic
Operating System: Alpine Linux v3.5 (containerized)
Total Memory: 120.1GiB
Docker Root Dir: /graph
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 15
System Time: 2017-03-27T21:13:23.942533878Z
Live Restore Enabled: false
WARNING: No swap limit support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
[desc] shows the docker component information and the system information that is collected by docker
$ docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
78445dd45222: Pull complete
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub.
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
For more examples and ideas, visit:
[desc] Pulls the docker image called ‘hello-world’ and shows a simple flow of docker.
$ docker pull alpine
[desc] Pulls an image called ‘alpine’ which is a lightweight Linux distro from docker Hub.
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
alpine latest 4a415e366388 3 weeks ago 3.99MB
ubuntu latest 0ef2e08ed3fa 4 weeks ago 130MB
hello-world latest 48b5124b2768 2 months ago 1.84kB
[desc] Displays the list of images in the host
$ docker run alpine echo “hello from alpine”
hello from alpine
[desc] Executes the passed command passed into a container.
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS
1ce2fa639c32 alpine “/bin/sh” 44 seconds ago Exited (0
) 13 seconds ago dazzling_jackson
2785afd14dcb alpine “echo ‘hello from …” 3 minutes ago Exited (0
) 3 minutes ago tender_volhard
ce2eac52e379 ubuntu “bash” 11 minutes ago Exited (1
) 11 minutes ago nervous_almeida
af52f465ea46 hello-world “/hello” 38 minutes ago Exited (0
) 38 minutes ago distracted_bell
[desc] Lists all the containers.