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

Bài viết khác

Build for global scale: AFK scale cube and basic rule to build an application for global scale

REF https://akfpartners.com/growth-blog/scale-cube

PostgreSQL : subquery, CTE

What is subquery in PostgreSQL? In PostgreSQL, a subquery is a query that is nested inside another query. The subquery is executed first, and its results are used as input to the outer query. Subqueries can be used in various contexts, such as in the SELECT, WHERE, and HAVING clauses of a query. For example, […]

Optimize SQL : rule and todo list

Some rule and todo list to Optimize SQL REF https://www.pgmustard.com/blog/indexing-best-practices-postgresql

PostgreSQL Compound indexes

What is Compound indexes in PostgreSQL? A compound index (also known as a composite index or a multi-column index) refers to an index that is created on two or more columns of a table. It allows PostgreSQL to quickly find rows that match a query condition based on the values in multiple columns, which can […]

Use AWS to deploy your applications and services

Amazon Web Services (AWS) is a cloud computing platform that provides a wide range of services to help businesses and individuals build and deploy applications in the cloud. AWS offers a variety of services such as compute, storage, databases, networking, security, and more. In this guide, we will walk through the steps to get started […]

Use docker to run go project

Docker is a powerful tool that enables developers to create, deploy and run applications in a containerized environment. Using Docker to run Go projects has many advantages, including the ability to isolate your application from the underlying operating system, simplifying the deployment process, and allowing for greater scalability and flexibility. In this guide, we will […]