Implementation of modifying configuration files in Docker container

Implementation of modifying configuration files in Docker container

1. Enter the container

docker run [option] image name [command passed to the startup container]

Description of common optional parameters:

  • -i means running the container in "interactive mode"
  • -t means that the container will enter its command line after it starts. After adding these two parameters, you can log in to the container after it is created. That is, allocate a pseudo terminal.
  • --name Name the created container
  • -v indicates the directory mapping relationship (the former is the host directory, and the latter is the directory mapped to the host, that is, host directory: directory in the container). Multiple -v can be used to map multiple directories or files. Note: It is best to do directory mapping, make changes on the host machine, and then share it to the container.
  • -d If you add the -d parameter after run, a guarded container will be created and run in the background (in this way, you will not automatically log in to the container after creating it. If you only add the -i -t parameters, you will automatically enter the container after creation).
  • -p means port mapping. The former is the host port and the latter is the mapping port in the container. You can use multiple -p to map multiple ports.
  • -e sets environment variables for the container
  • --network=host means mapping the host's network environment to the container, and the container's network is the same as the host's

2. Find the configuration file

# Display file ls
The results are as follows:
LICENSE.txt README.textile config lib modules
NOTICE.txt bin data logs plugins
 
# Enter the configuration folder cd config
 
# Display file ls
The results are as follows:
elasticsearch.keystore ingest-geoip log4j2.properties roles.yml users_roles
elasticsearch.yml jvm.options role_mapping.yml users
 
# Modify the configuration file vi elasticsearch.yml

When using the docker container, Vi may not be installed. apt-get install vim . If it prompts: Unable to locate package vim, you need to type: apt-get update update. After the update is complete, type the command: apt-get install vim

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to set port mapping for running container in Docker
  • How to modify the contents of an existing Docker container
  • How to view files in Docker image
  • Docker file storage path, modify port mapping operation mode

<<:  A brief discussion on how to write beautiful conditional expressions in JS

>>:  In-depth analysis of the Identifier Case Sensitivity problem in MySQL

Recommend

How to implement the observer pattern in JavaScript

Table of contents Overview Application scenarios ...

If I change a property randomly in Vue data, will the view be updated?

Interviewer: Have you read the source code of Vue...

Install Apple Mac OS X in VMWare12 Graphic Tutorial

1. Introduction: Because my friend wanted to lear...

Summary of block-level elements, inline elements, and variable elements

Block element p - paragraph pre - format text tabl...

Bootstrap FileInput implements image upload function

This article example shares the specific code of ...

In-depth analysis of the Linux kernel macro container_of

1. As mentioned above I saw this macro when I was...

Detailed explanation of Object.create instance usage in js

1. Create a new object using the Object.create() ...

Install and build a server environment of PHP+Apache+MySQL on CentOS

Yum (full name Yellow dog Updater, Modified) is a...

Native js to implement drop-down box selection component

This article example shares the specific code of ...

Detailed explanation of .bash_profile file in Linux system

Table of contents 1. Environment variable $PATH: ...

Build a severe weather real-time warning system with Node.JS

Table of contents Preface: Step 1: Find the free ...

Detailed explanation of the steps to create a web server with node.js

Preface It is very simple to create a server in n...

Solution to the horizontal scroll bar in iframe under IE6

The situation is as follows: (PS: The red box repr...

Summary of the data storage structure of the nginx http module

Starting from this section, we will explain the i...

Detailed analysis of when tomcat writes back the response datagram

The question arises This question arose when I wa...