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

The first lesson of Docker-

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Overview

Docker is an open source application container engine based on the Go language and conforming to the Apache2.0 protocol. Docker allows developers to package applications and dependency packages into a lightweight, portable container and publish them to any popular Linux machine. Docker concept: Build, Ship, and Run Any App, Anywhere.

two。 Installation

Windows system:

Download it from https://www.docker.com/products/docker-toolbox and install it directly.

The above picture on the desktop indicates that the installation is successful.

Centos system:

Yum install-y docker-engine

Enter: docker version, the following figure indicates that the installation is successful.

3. Basic concept

The docker architecture is shown in the following figure:

Client:Docker user interface, can accept user commands and configuration identification, and communicate with Docker daemon

Docker daemon:Docker daemon is a background process that runs on the host and can communicate with it through the Docker client

The Image:Docker image is a read-only template with instructions for creating a Docker container

The Container:Docker container is a runnable instance of a Docker image

Registry:Docker Registry is a service that centrally stores and distributes images.

4. Related command

Mirror correlation

a. Search for images (docker search)

From the returned results, you can see the name, description, popularity, official creation and automatic creation of the image.

b. Download Image (docker pull)

From the returned result, you can see the source of the image and the tag of the image. You can decide the download version of the image through tag. Default is latest.

c. View an existing image (docker images)

You can see all the mirrors in the computer.

d. Delete Mirror (docker rmi centos)

The image version to be deleted can be decided through tag. The default is latest.

e. Run Mirror (docker run)

The parameter-v means that the mount host directory is a data volume. In this case, the / opt directory in the operation image is equivalent to the / home directory of the operation host, which is equivalent to the function of a shared folder;-I means it has been run interactively;-t means that the container redistributes a pseudo-input terminal.

Container dependence

a. Launch Container (docker start)

When you run an image using docker run, a container is automatically created with a container ID of 7bf.

After you stop the container from running using docker stop, you can rerun it using docker start:

After the container is running, you can view the running container through docker ps.

b. Termination Container (docker stop)

Just enter the first few digits of the container ID.

c. Enter the container

Two commands, attach and exec, are mainly introduced.

Attach mode:

Defect of attach: when multiple windows are connected to the same container at the same time using the attach command, all windows are displayed synchronously, and if one window fails, the rest of the windows can no longer perform operations.

Exec mode:

d. Delete Container (docker rm)

Note the difference between deleting a mirror and deleting a mirror. Deleting a mirror is docker rmi.

e. Save container as mirror (docker commit)

Save as a mirror and use it the same as a general mirror.

Original link: https://mp.weixin.qq.com/s/I_6_V8isSRiiThEnAIdHWg

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

Servers

Wechat

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

12
Report