Using Docker Machine, we can set up Docker hosts on local systems, on cloud providers, and other environments very easily. We’ll cover that in a different recipe.

How to To Install Docker on centos

$ yum -y install docker
How it works…
The preceding command will install Docker and all the packages required by it.

The default Docker daemon configuration file is located at
/etc/sysconfig/docker
which is used while starting the daemon.

ls -al /var/lib/docker
ls -al /var/lib/containerd

To verify the installation:
$ docker info

or just check : systemctl status docker

or Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world

To start the service:
$ systemctl start docker

To update the package:
$ yum -y update docker

To enable the service start at boot time:
$ systemctl enable docker
To stop the service:
$ systemctl stop docker
For more detail, The installation document is on the Docker website at
https://docs.docker.com/installation/

Pulling an image and running a container

To pull an image, run the following command:
$ docker pull fedora
List the existing images by using the following command:
$ docker images

To search an image on a Docker registry, run the following command:
docker search TERM
For example, The following is an example to search a Fedora image:
$ docker search fedora | head -n5”

How to Exporting an image

Pull or import one or more Docker images on the Docker host.
Use the following syntax to save the image in the tar file:
$ docker save [-o|–output=””] IMAGE [:TAG]
For example, to create a tar archive for Fedora, run the following command:
$ docker save –output=fedora.tar fedora”

Importing an image

To import an image, we can use following syntax:
$ docker import URL|- [REPOSITORY[:TAG]]
Here’s an example using the preceding syntax:
$ cat fedora-latest.tar | docker import – fedora:latest
Alternatively, you can consider the following example:
$ docker import http://example.com/example.tar example/image”

Deleting an image

To remove the image from the host, we can use the docker rmi command. However, this does not remove images from the registry.
Make sure one or more Docker images are locally available.
To remove the image, consider the following syntax:
$ docker rmi [ OPTIONS ] IMAGE [IMAGE…]
In our case, here’s an example using the preceding syntax:
$ docker rmi nkhare/fedora:httpd”

Building images using Dockerfiles

Dockerfiles help us in automating image creation and getting precisely the same image every time we want it. The Docker builder reads instructions from a text file (a Dockerfile) and executes them one after the other in order. It can be compared as Vagrant files, which allows you to configure VMs in a predictable manner.

# Keyword
CI/CD, OpenShift, Drone, PaaS

# Ref
https://docs.docker.com/engine/install/centos/

Docker là gì? Tìm hiểu về Docker

About the Author

Trần Huy

View all author's posts

Bài viết khác

Tìm hiểu Hexagonal Architecture

Hexagonal Architecture là gì? Hexagonal Architecture (tên gọi khác là ports and adapters architecture), là một mẫu kiến trúc được dùng trong thiết kế phần mềm. Nó hướng tới việc xây dựng ứng dụng xoay quanh business/application logic mà không ảnh hưởng hoặc phụ thuộc bởi bất kì thành phần bên ngoài, mà chỉ giao […]

Go-pg

go-pg là một thư viện ORM (Object-Relational Mapping) và trình điều khiển PostgreSQL cho ngôn ngữ lập trình Go. Nó cung cấp một cách tiện lợi để tương tác với cơ sở dữ liệu PostgreSQL bằng cách ánh xạ các cấu trúc (structs) trong Go thành các bảng trong cơ sở dữ liệu và ngược […]

Ngôn ngữ lập trình Golang

Golang là gì? Go (hay còn gọi là Golang) là một ngôn ngữ lập trình được thiết kế dựa trên tư duy lập trình hệ thống. Go được phát triển bởi Robert Griesemer, Rob Pike và Ken Thompson tại Google vào năm 2007. Điểm mạnh của Go là bộ thu gom rác và hỗ trợ […]

Tìm hiểu RESTful API

RESTful là gì? REST (Representational State Transfer) là gì? REST (Representational State Transfer) không phải là một ngôn ngữ lập trình hay một framework, mà là một kiểu kiến trúc phần mềm (architectural style) để thiết kế các hệ thống mạng phân tán, đặc biệt là các dịch vụ web (web services). Nó được giới […]

Hệ quản trị CSDL PostgreSQL

SQL là gì? SQL (Structured Query Language) là viết tắt của Ngôn ngữ truy vấn có cấu trúc, là ngôn ngữ được tiêu chuẩn hóa để tương tác với các hệ thống quản lý cơ sở dữ liệu quan hệ (RDBMS). Cơ sở dữ liệu quan hệ là tập hợp dữ liệu được tổ chức thành các […]

Flutter Form

FLUTTER FORM LÀ GÌ? Form trong Flutter là một widget dùng để thu thập và kiểm tra dữ liệu người dùng nhập vào. Khi ứng dụng yêu cầu nhập nhiều trường (fields) và cần xác minh tính hợp lệ của các giá trị này, việc sử dụng Form kết hợp với TextFormField là giải pháp […]