docker 101 – v1.0

A brief introduction to docker and basic command usage

Advertisements

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.

Docker-Teardown-02-(Architecture)

 

[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
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
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
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary:
containerd version: 422e31ce907fd9c3833a38d7b8fdd023e5a76e73
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-66-generic
Operating System: Alpine Linux v3.5 (containerized)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 120.1GiB
Name: node1
ID: 6G4R:WLVX:O53M:A3HR:WJKW:6NRK:TPXG:V6IN:TOWW:QBGT:ICGC:DTWQ
Docker Root Dir: /graph
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 15
Goroutines: 23
System Time: 2017-03-27T21:13:23.942533878Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.1
127.0.0.0/8
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
Digest: sha256:c5515758d4c5e1e838e9cd307f6c6a0d620b5e07e6f927b07d05f6d12a1ac8d7
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:
https://cloud.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/engine/userguide/

[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
PORTS NAMES
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.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s