Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use of Docker

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "Docker installation and use method". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

overview

Docker is an open source software, an open platform for developing applications, delivering applications, and running applications.

Docker allows users to separate applications from their infrastructure into smaller particles (containers), thereby increasing the speed at which software can be delivered.

Docker containers are similar to virtual machines, but they differ in principle. Containers virtualize the operating system layer, and virtual machines virtualize hardware, so containers are more portable and use servers efficiently. A container is more of a standardized unit used to represent software. Because containers are standardized, they can be deployed anywhere regardless of infrastructure differences. Docker also provides stronger industry isolation compatibility for containers.

architecture

Components in the architecture diagram:

Docker daemon (background process)

Docker daemon is a background process running on the host machine (DOCKER_HOST) and can be communicated with through Docker clients

Client (Docker client)

Docker client is Docker user interface, can accept user commands and configuration identification, and communicate with Docker daemon

Images (Docker images)

Docker image is a read-only template that contains instructions for creating Docker containers, similar to the system installation CD, and uses Docker images to run programs in it.

4. Container

Containers are runnable instances of mirrors

The relationship between mirrors and containers is somewhat similar to the relationship between classes and objects in object-oriented

Docker API or CLI commands can be used to start, stop, move and delete containers

5、Registry

Docker Registry is a centralized storage and distribution service for images.

Docker Registry can be used to avoid manual copying of images

A Docker Registry can contain multiple Docker repositories->

Each repository can contain multiple mirror tags->

One Docker image per label

Docker registries can be divided into public and private Docker registries.

The most common Docker Registry is the official Docker Hub, which is also the default Docker Registry

installation

Installation environment: CentOS7

Set yum sourceyum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoyum-config-manager--enable docker-ce-edgeyun-config-manager --enable docker-ce-testConfigure Docker image sourcemkdir/etc/dockersudo tee/etc/docker/daemon.json Image service-> Replication accelerator address

install Dockeryum install docker-ce#install Dockerservice docker start#start Docker service Portainer management Docker introduction

Portainer is a lightweight graphical management tool that makes it easy to manage different docker environments. Portainer is simple to deploy and use, and consists of a container that can run on any docker engine.

Portainer features are comprehensive, providing status display panel, rapid deployment of application templates, basic operations of container mirroring network data volumes (including uploading and downloading images, creating containers, etc.), event log display, container console operations, centralized management and operations of Swarm clusters and services, login user management and control, etc. It can basically meet all the needs of small and medium-sized units for container management.

install start docker pull portainer/portainer#pull mirror docker volume create portainer_data#create Volume, keep data persistent docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer#start Portainer

docker command description:

docker run: Create and start a new container

-d: Silent start

-p 9000:9000: Specify exposure port as 9000

--name portainer: Specify container name, customizable

--restart always: Specify that the restart policy after the container exits is always restart

-v /var/run/docker.sock:/var/run/docker.sock: Get Docker socket,

-v portainer_data:/data: Data volumes are used to persist data, life cycle is independent of containers, Docker does not automatically delete data volumes after containers are deleted

portainer/portainer: Specify mirror

About docker.sock

Simply put, the/var/run/docker.sock file is the Unix domain socket that Docker daemons listen to by default, and processes in containers can communicate with Docker daemons through it.

For example, Portainer communicates with Docker daemons ** via bound **/var/run/docker.sock files to perform various administrative operations.

Portainer makes it easy to create containers. HTTP requests are actually sent to the Docker daemon via docker.sock. This can be illustrated by curl creating containers. Running a container using the HTTP interface requires two steps, first creating the container and then starting it.

Note: After binding Docker sockets, the container will have high permissions to control Docker daemons. Therefore, this must be used with caution and only with containers that are trusted enough.

use

You need to create a password for the first time. After entering the main page, as shown below:

You can create, start, stop, delete containers directly on the page

At the same time, you can also add and delete Volume and NetWorks.

"Docker installation and use method" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report