較舊版本的Docker被稱爲docker或docker-engine。若是已安裝這些,請卸載它們以及相關的依賴項。html
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
保留/var/lib/docker/的內容,包括圖像,容器,卷和網絡。
Docker Engine - 社區包如今稱爲docker-ce。node
您能夠根據須要以不一樣方式安裝Docker Engine。linux
這次演示,咱們選擇社區推薦的方法,也就是設置存儲庫的方法。git
`sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2`github
`sudo yum-config-manager \
--add-repo \
https://download.docker.com/l...`docker
你能夠安裝最新版yum install docker-ce docker-ce-cli containerd.io
bootstrap
也能夠經過命令查看支持的版本號,進行特定版本安裝ubuntu
yum list docker-ce --showduplicates | sort -r
centos
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
bash
sudo systemctl start docker
經過運行hello-world映像驗證Docker Engine - 社區是否已正確安裝。
sudo docker run hello-world
[root@VM_0_11_centos ~]# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ ```
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
version: '2.2' services: cerebro: image: lmenezes/cerebro:0.8.3 container_name: cerebro ports: - "9000:9000" command: - -Dhosts.0.host=http://elasticsearch:9200 networks: - es7net kibana: image: docker.elastic.co/kibana/kibana:7.2.0 container_name: kibana7 environment: - I18N_LOCALE=zh-CN - XPACK_GRAPH_ENABLED=true - TIMELION_ENABLED=true - XPACK_MONITORING_COLLECTION_ENABLED="true" ports: - "5601:5601" networks: - es7net elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0 container_name: es7_01 environment: - cluster.name=geektime - node.name=es7_01 - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.seed_hosts=es7_01 - cluster.initial_master_nodes=es7_01 ulimits: memlock: soft: -1 hard: -1 volumes: - es7data1:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - es7net volumes: es7data1: driver: local networks: es7net: driver: bridge
在騰訊雲上面,想搭建一套elasticsearch集羣,發現discover的時候,獲取不到集羣信息。
後面發現是因爲 network.host這個配置也包含了network.publish_host這個配置了。
那麼在騰訊雲上面,就會出現這兩個地址同時指向了騰訊雲服務器的內網ip,致命的是兩臺服務器的內網IP並不能互通,致使了這個問題。
解決這個問題也很簡單
network.host: $內網IP$ network.publish_host: $公網IP$
另外附上官網network配置說明
docker-compose up
docker-compose down
docker-compose down -v
docker ps docker stop Name/ContainerId docker start Name/ContainerId
-f, –force=false; -l, –link=false Remove the specified link and not the underlying container; -v, –volumes=false Remove the volumes associated to the container
rm docker ps -a -q
start Name/ID kill Name/ID restart name/ID