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

Docker Image Management and acceleration site

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

I. concept

To put it simply, an image is a concrete packaged container environment, which does not include a kernel but a compact operating system.

Configure the image acceleration site

When we are in pull Image, docker is downloaded from foreign Docker Hub by default, so it will be very slow. Let's solve this problem by configuring domestic acceleration sites.

1. Edit the / etc/docker/daemon.json file and configure it as follows

{

"registry-mirrors": ["http://hub-mirror.c.163.com"]"

}

2. Restart docker

Systemctl restart docker

3. Check whether the configuration is effective.

Using the docker info command, you can see the acceleration site that Registry Mirrors has displayed for our configuration

III. Mirror management

1. Download the image from the image repository

Docker pull nginx

2. View the image

Docker image ls

You can see the nginx image downloaded in step 1

3. Package the image

Package the nginx image and specify that the archive file name is nginx.tar

Docker save nginx > nginx.tar

4. Delete the image

Docker image rm nginx

At this point, we delete the image and then use ls to view it. We can see that there are no images left.

5. Load the image

Docker load

< nginx.tar 使用load命令将第3步打包的镜像加载回去,再使用ls可以看到镜像加载成功 6、使用镜像创建容器 docker run -itd --name nginx1.0 nginx 这里指定容器名为nginx1.0,镜像为nginx 7、将容器打包 4858b7bd6ad8为第6步创建的容器id docker export 4858b7bd6ad8 >

Nginx1.0.tar

8. Create an image using the tar file packaged by the container

Docker image import nginx1.0.tar

Using the ls command to view, we can see that a new image has been created, but both REPOSITORY and tag are empty

We can create the specified REPOSITORY and tag again

Docker image import nginx1.0.tar nginx1.0:v1

9. Mark the image

Docker tag nginx1.0:v1 nginx1.0:v2

A new image is created with a tag of v2

10. View image details

Docker inspect nginx

There is a lot of content in it. Here, only part of it is intercepted. You can see some path information corresponding to the image.

11. View the historical layering of the image

Docke history nginx

You can see the corresponding dockefile command and size of each layer of the mirror.

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