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

What is the method for Docker to modify hostname after creating a container?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Xiaobian to share with you Docker to create a container and then modify the hostname method is what, I believe most people do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

I have a container called m2 and I want to change its hostname.

1. Check the location of the container configuration file on the host. Here, you can see/var/lib/docker/containers/67e012c02434168aff3762ab4edf7550f0bfe1db57b396ce78660f140dd3056e

2. Close the container, close the docker service preconditions, very important!!! Prerequisites are very important!! Prerequisites, very important!!!

3. Enter the folder of the host where the configuration file of the container is located and search for the original hostname. You can see that we need to modify three places, namely config.v2.json, hostname and hosts.

4. Make a backup before modification

5. Modify these three places

6. Start docker service, start container, view hostname

hostname modified successfully!

The above is "Docker creates a container and then modifies the hostname method is what" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

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

Development

Wechat

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

12
Report