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.
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).
The installation process only takes Debian-based distributions into account. It can be installed on RedHat-derived distributions using rpm (CentOS, Fedora, RedHat, RHEL, SuSE) using this procedure if you have yum or this procedure using zypper.
Also notice that for RHEL (the enterprise version of RedHat) and SLES (the enterprise version of SuSE) only Docker EE (Enterprise Edition) is supported. It is entirely possible to install the CE versions (i.e. for test purposes) but of course this voids all support from RedHat, SuSE, etc..
bakunin
Last edited by bakunin; 01-06-2019 at 08:13 AM..
Reason: corrected link
These 2 Users Gave Thanks to bakunin For This Post:
Wouldn't it be more wider to not limit to 'Docker' but a more general 'Containers' ?
This would, in theory, cover all possible container variations, starting from zones, jails to any kubernets implementation (docker, c-rio etc.)
The 'containers' would be a focal point to seek advice about all single kernel virtualization techs and their implementations such as docker swarm, openshift, zoneclusters etc.
It's a very big topic regarding security, implementation, network layer (vxlans), various APIs and build/versioning tools.
Regards
Peasant.
These 3 Users Gave Thanks to Peasant For This Post:
Yes I scond "Containers". Docker and others to be mentioned in the short description.
Some years ago there was a discussion "Nagios" versus "Infrastructure Monitoring"...
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
I think, for now, I leave it as "Docker" because I seriously doubt we will see a lot of "container" posts; and Ravinder's goal is to focus on Docker and attract Docker users.
If anyone wants to post a lot of "Container" discussions, then we will consider making a "Container" forum. Having a specific forum is not going to cause people to post; and in the past, specific names to forums that were requested also did not result in people flocking to post because a forum had a specific name.
So in my view, we don't need to think about "forums" too much, just tag "containers" and behold, we have full access to all container discussions.
Ravinder wanted a Docker forum, so he has one because he plans to post a lot here. If he does not follow though, I will eventually move all the discussions in the "Docker" forum elsewhere.
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)
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)
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)
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)
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)
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)
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)