docker installation elasticsearch and Vim installation error

docker installation elasticsearch

Simple operation

(1) View local images Image

  docker images

(2) View containers that are running on this machine

   docker ps

(3) pull image from dockerhub

  docker pull image name

Installation and configuration

  1. Docker search esearch all elasticsearch versions on dockerhub

  2. docker pull es:7.5.1 choose to download version 7.5.1

  3. Single node runs es command docker run -d --name es -p 9200:9200 -p 9300:9300 -e“ discovery.type=single-node” docker.io/elasticsearch ,

  4. Download kibana, corresponding to es version

    • docker starts kibana
      docker run --name my-kibana -e ELASTICSEARCH_URL=http://192.168.99.100:9200 -p 5601:5601 -d kibana:7.5.1

docker run simple parameter description

parameter explain
–name Specifies the name of the container
-d Specifies whether the container runs in the foreground or the background. The default is false
-p Specifies the port on which the container is exposed
-e Specifies the environment variable for the container

Modify profile

  • Enter container

    • docker exec -it es /bin/bash
    • windows powerShell needs to change / bin/sh or / bin/bash to SH and Bash
    • Gitbash enters the docker container and adds the prefix winpty docker exec -it es bash
  • vi elasticsearch.yml

Join cross domain configuration

	http.cors.enabled: true
	http.cors.allow-origin: "*"
  • PS: if you want to access the elastic search service in docker outside windows, you need to access the ip address and port number assigned by docker, such as (192.168.99.100:9200). You cannot directly access localhost

Problems encountered and Solutions

bash: vi: command not found Question:

  • Because vim and vi are not installed

Execute apt get install VIM prompt:

Reading package lists... Done
Building dependency tree 
Reading state information... Done
E: Unable to locate package vim
  • In this case, you need to execute:

    apt-get update
    

    The function of the command is to:

    • Synchronize / etc/apt/sources.list And / etc/apt/sources.list.d to get the latest package.
  • After the command is updated, execute the apt get install VIM command to install successfully.

The situation that apt get command cannot be used

  1. First, we pull a ubuntu image
docker pull ubuntu
  1. Then run
docker run -it ubuntu /bin/bash
  1. Important - set the ubuntu apt get source (official ubuntu and Alibaba cloud) to execute the following commands
sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list  

apt-get clean

apt-get update

apt-get upgrade

Failed to install vim due to network problems in China, directly set the sources image

echo "">sources.list

echo "deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse">>sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse">>sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse">>sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse">>sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse">>sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse">>sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse">>sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse">>sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse">>sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse">>sources.list

vim direction key not available

vim  ~/.vimrc

add to
 :set term=builtin_ansi save exit

Tags: Docker Ubuntu vim ElasticSearch

Posted on Mon, 15 Jun 2020 03:04:48 -0400 by php_blob