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 modify files in docker container directly

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

Share

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

This article will explain in detail how to directly modify the files in the docker container. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

How to modify files in the docker container directly? Modify the file in the docker container (container). Take mysql as an example, there are two ways to modify the MySQL configuration file:

1. Enter the container, modify the configuration file of MySQL in the container, and then restart the container, for example:

$sudo docker exec-it pwc-mysql / usr/bin/bash

Then you can enter the command line mode of the container, and then modify the / etc/mysql/my.cnf file

2. Mount the mysql configuration file of the host. The official documents are as follows:

The MySQL startup configuration is specified in the file / etc/MySQL/my.cnf, which in turn contains any files that end with .cnf in the / etc/MySQL/conf.d directory. The settings in the files in this directory will increase and / or overwrite the settings in / etc/mysql/my.cnf.

If you want to use a custom MySQL configuration, you can create an alternate configuration file in a directory on the host and load that directory location into the MySQL container as / etc/MySQL/conf.d.

If / my/custom/config file.cnf is the path and name of the custom configuration file, you can start the mysql container like this (note that only the directory path of the custom configuration file is used in this command):

$docker run-- name some-mysql-v / my/custom:/etc/mysql/conf.d-e MYSQL_ROOT_PASSWORD=my-secret-pw-d mysql:tag

This starts a new container some mysql, where the mysql instance uses a combination of / etc/mysql/my.cnf and / etc/mysql/conf.d/config-file.cnf startup settings, the latter of which takes precedence.

Container cloud products are implemented by deploying container cloud services on cloud computing cluster servers through docker technology. They are powerful and easy to use, and can be used as cluster services. Private networks can be built freely and service clusters can be easily built.

On how to directly modify the files in the docker container to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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