Sponsored Content
Full Discussion: Docker learning Phase-I
Special Forums UNIX and Linux Applications Docker Docker learning Phase-I Post 303028377 by RavinderSingh13 on Sunday 6th of January 2019 05:41:26 AM
Old 01-06-2019
Docker learning Phase-I

Hello All,

I had recently learnt a bit of Docker(which provides containerization process).
Here are some of my learning points from it.

Let us start first with very basic question:

What is Docker:
Docker is a platform for sysadmins and developers to DEPLOY, DEVELOP and RUN applications with containers.

The use of Linux containers to deploy applications is called containerization.

Flexible: Even the most complex applications can be containerized.
Lightweight: Containers leverage and share the host kernel.
Interchangeable: You can deploy updates and upgrades on-the-fly.
Portable: You can build locally, deploy to the cloud, and run anywhere.
Scalable: You can increase and automatically distribute container replicas.
Stackable: You can stack services vertically and on-the-fly.


What is an Image: We could say Image as an executable which has all things needed to run an application EG--> code, libraries, environment variables, config files.

What is Container: Whenever we run an image then its executable form is called Container.

Prerequisites: Ubuntu/Linux server then in case you need to publish your images to Docker repository an account on Docker HUB.

Steps for installing Docker:

1st Step: Use curl command to install its binaries along with apt-key to make sure downloads are valid.

Code:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

2nd Step: Add Docker repository to APT resources:
Code:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

3rd Step: Update apt-get for Ubuntu server(where we are going to learn Docker)
Code:
sudo apt-get update

4th Step: To make sure we are going to install Docker from Docker's repo rather than default Ubuntu 16.04 repo run following.
Code:
apt-cache policy docker-ce

5th Step: Finally Install Docker now.
Code:
sudo apt-get install -y docker-ce

6th Step: Run systemctl to make sure that this service is added in rc boot of server and should come up after reboot of server.
Code:
sudo systemctl status docker

● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-10-18 20:28:23 UTC; 35s ago
     Docs: https://docs.docker.com
 Main PID: 13412 (dockerd)
   CGroup: /system.slice/docker.service
           ├─13412 /usr/bin/dockerd -H fd://
           └─13421 docker-containerd --config /var/run/docker/containerd/containerd.toml

7th Step: Now lets run only docker command and see what output is coming.
Code:
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

8th Step: Check for docker version by running as follows.
Code:
docker --version
Docker version 18.09.0, build 4d60db4

9th Step: Pull first image from Docker's repository as follows.
Code:
docker run hello-world

Output approximate will be as follows.
Code:
...
Hello from Docker!
This message shows that your installation appears to be working correctly.
...

Will post further details on how to call a basic Python program through Docker image and show how it will NOT require packages(needed by that program) for your Ubuntu server(they will be their in containers to support programs not in local server).

One could refer Docker site's documentation in link Docker Documentation | Docker Documentation too.

Stay tuned with this thread. Your edits/views/comments/feed back are Welcome Smilie


Hello Neo,

Would like to request you if we can create a new forum for Docker, so users could post threads there.
Kindly do let me know your views on same.


Thanks,
R. Singh

Last edited by RavinderSingh13; 01-06-2019 at 07:56 AM..
These 2 Users Gave Thanks to RavinderSingh13 For This Post:
 

8 More Discussions You Might Find Interesting

1. Solaris

init phase

Hello, Can somebody explain me the relationship between /sbin and /etc directories ? what is the relationship between them and what are the roles of files such as rcd.1 etc? (1 Reply)
Discussion started by: saudsos
1 Replies

2. Linux

Docker and pipework,ip with other subnet

Recently i found this for give to docker a "personal" ip ip addr del 10.1.1.133/24 dev eth0 ip link add link eth0 dev eth0m type macvlan mode bridge ip link set eth0m up ip addr add 10.1.1.133/24 dev eth0m route add default gw 10.1.1.1On container i did ... (0 Replies)
Discussion started by: Linusolaradm1
0 Replies

3. What is on Your Mind?

Prototyping New Responsive Mobile for UNIX.COM - Phase II

Have completed "Phase I" of our project "Prototyping New Responsive Mobile UNIX.COM", I am now moving to "Phase II" which will be changing many of the menus and buttons to use Javascript and CSS for the mobile site menus. For example, here is the new "main side menu" for the mobile site (below).... (63 Replies)
Discussion started by: Neo
63 Replies

4. Shell Programming and Scripting

Problem in extracting yocto SDK for docker

Actually I was facing the following issue while building my Yocto SDK on Docker container sudo docker build --tag="akash/eclipse-che:6.5.0-1" --tag="akash/eclipse-che:latest" /home/akash/dockerimage.yocto.support/ Sending build context to Docker daemon 26.93MB Step 1/5 : FROM eclipse/cpp_gcc ... (3 Replies)
Discussion started by: Akash BHardwaj
3 Replies

5. UNIX for Beginners Questions & Answers

Can't pass a variable representing the output of lsb_release to a docker dontainer

I don't know why, but the rendering of my code mucks up the spacing and indentation, despite being correct in the original file. I'm having issues getting the following script to run (specifically the nested script at the end of the docker command near the end of the script; I think I'm not passing... (2 Replies)
Discussion started by: James Ray
2 Replies

6. War Stories

Postbit Changes (Phase II Upgrade)

Next in the pipeline, thinking I will work on postbit (the core of the posts) and try to get Bootstrap and badges working in postbit and not break the quick editors in the post. Note, I had to turn off the scrollbars in postbit for now because when I turn them on, it breaks the quick editor in... (11 Replies)
Discussion started by: Neo
11 Replies

7. Shell Programming and Scripting

XML Phase with awk

Hi Guys, Input XML File :- <managedObject class="RMOD_R" distName="MRBTS-101/X/R-7"> <list name="activeCellsList"> <p>15</p> <p>201</p> </list> <p name="aldManagementProtocol">True</p> <p name="serialNumber">845</p> </managedObject> Output :- ... (5 Replies)
Discussion started by: pareshkp
5 Replies

8. What is on Your Mind?

Update to Advanced Search Page (Phase 1)

Update: I have completed the first phase of revamping the "Advanced Search" page using Bootstrap (desktop not mobile yet): https://www.unix.com/search.php https://www.unix.com/search.php I may change this to a Bootstrap modal later and change the CSS a bit more; but for now it is much... (0 Replies)
Discussion started by: Neo
0 Replies
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy