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

How to use the docker container?

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

Share

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

Today, I will talk to you about how to use the docker container. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

How to use the docker container? Docker container can solve a lot of problems, it is fast, lightweight, and the memory footprint is very small. As long as you allocate memory to the main process and add dozens of MB, starting a container is as fast as starting a single process. It doesn't take a few minutes, and you can start it in seconds. There are several principles we need to follow when creating a container that uses docker.

Do not create an oversized mirror

An oversized image will only be difficult to distribute. Make sure you only have the necessary files and libraries to run your application / process. Do not install unnecessary packages or run updates (yum updates) during creation.

Do not run more than one process in a single container

CCS can run a single process (http daemon, application server, database) perfectly, but if you have more than one process, you will have trouble managing, getting logs, and updating independently.

Do not store data in a container

Containers may be stopped, destroyed, or replaced. Version 1.0 of a program running in a container should be easily replaced by version 1.1 without affecting or losing data. For this reason, if you need to store data, store it in the volume, and note that it will crash if two containers write data on the same volume. Make sure your application is designed to write on a shared data store.

Run the process with a non-root user

"the docker container runs as root by default. As docker matures, more security default options become available. Nowadays, requesting root is dangerous for others and may not be available in all environments. Your image should use the USER directive to instruct a non-root user of the container to run."

Do not create a mirror for a running container

In other words, do not use the "docker commit" command to create a mirror. This method of creating a mirror is neither reproducible nor versioned and should be avoided completely. Always use Dockerfile or any other fully reproducible S2I (source-to-mirror) method

After reading the above, do you have any further understanding of how to use the docker container? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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