Docker使用总结

1、什么是Docker

docker是一门容器技术,其作用是解决软件跨环境迁移的问题

2、三大概念

仓库:一个总的仓库,包含所有的镜像,使用时可以从库拉取镜像到本地。 镜像:从库中拉取下来的应用,比如mysql 容器:镜像运行之后就是容器,容器和镜像可以互相转换 

3、Docker安装

 yum update  yum install -y yum-utils device-mapper-persistent-data lvm2  yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo  yum install -y docker-ce  docker -v 

4、常用指令

 docker pull xx:5.6 docker run xx docker stop xx  docker images  docker ps docker run --name smartpark -p 8081:8081 -d smartpark # --name 别名 --env 环境变量 -d 后台执行 --link ip映射 -p 端口映射  docker run --name mywordpress --link db:mysql -p 8080:80 -d wordpress  docker logs -f smartpark  docker rm 27dfa1fc17bc  docker port CONTAINER_ID  docker top name 

5、Dockerfile

Dockerfile 是一个用来构建镜像的文本文件,文本内容包含了一条条构建镜像所需的指令和说明。

//Dockerfile文件 FROM java:8  MAINTAINER itfeng<xxxxxx666@163.com>   ADD ./group5-0.0.1-SNAPSHOT.jar app.jar  CMD java -jar app.jar  

Dockerfile构建镜像

 docker build -f ./Dockerfile -t app . 

创建容器

 docker run -id -p 7777:7777 app 

6、compose

一个方便维护多个容器的yaml文件,docker认为一个容器对应一个进程,但一个应用会有多个进程,例如上面的mysql和wordpress。类似于shell脚本,访问的是docker的一些api。

   docker-compose logs  docker exec -it name /bin/sh 

编写 docker-compose.yml 文件

services: textrank4zh: image: textrank4zh:latest container_name: multimodal_textrank4zh restart: always ports: - 8003:5001 texsmart: image: texsmart_sdk:latest container_name: multimodal_texsmart restart: always ports: - 8002:5000 ltp: image: ltp_project:latest container_name: multimodal_ltp restart: always ports: - 8001:5000 ocr: image: jxy:5000/ocr:cpu_1.0 container_name: multimodal_ocr restart: always ports: - 8000:8000 command: /bin/bash -c "sh /run.sh" asr: image: withassess_asr:latest container_name: multimodal_asr restart: always ports: - 8004:12309 milvus: image: milvusdb/milvus:1.0.0-cpu-d030521-1ea92e container_name: multimodal_milvus restart: always ports: - 19530:19530 - 19121:19121 volumes: - ./milvus/db:/var/lib/milvus/db - ./milvus/conf:/var/lib/milvus/conf - ./milvus/logs:/var/lib/milvus/logs - ./milvus/wal:/var/lib/milvus/wal logo: image: logo_reco:v1.0.1 container_name: multimodal_logo command: /bin/bash /home/start.sh restart: always ports: - 9002:9002 volumes: - ./logo/:/opt pic_search: image: pic-search:V1.0.1 container_name: multimodal_pic_search restart: always ports: - 5002:5002 environment: - MILVUS_HOST=192.168.2.230 - MILVUS_PORT=19530 - MINIO_ADDR=192.168.2.230:9000 - MINIO_ACCESS_KEY=minio - MINIO_SECRECT_KEY=jxy@1314 command: /bin/bash /home/pic_search/start.sh application: image: cyw_multimodal-application container_name: cyw_multimodal_application restart: always ports: - 1998:1998 environment: - MYSQL_SERVER=192.168.2.230:13306 - MYSQL_DATABASE=multimodal - MYSQL_USER=root - MYSQL_PASSWORD=123456 - KAFKA_SERVERS_ONE=192.168.2.230:19092 - KAFKA_SERVERS_TWO=192.168.2.230:19093 - KAFKA_SERVERS_THREE=192.168.2.230:19094 - ELASTICSEARCH_SERVER=192.168.2.230:9200 - REDIS_HOST=103.59.148.101 - REDIS_PORT=6379 - REDIS_PASSWORD=jixianyuan123 - MINIO_SERVER=http://192.168.2.230:9000 - MINIO_ACCESSKEY=minio - MINIO_SECRETKEY=jxy@1314 - MINIO_BUCKET_NAME=multimodal - OCR_SERVER=http://192.168.2.230:8000/paperRecognition - ENTITY_SERVER=http://192.168.2.230:8002/entity - KEYWORD_SERVER=http://192.168.2.230:8003/keyword - ASR_SERVER=http://192.168.2.230:8004/http/gop - ABS_SERVER=http://192.168.2.230:8003/abstract - PICVECTOR_SERVER=http://192.168.2.230:5002/api/v1/index - PICSEARCH_SERVER=http://192.168.2.230:5002/api/v1/imgsearch - VIDEOSEARCH_SERVER=http://192.168.2.230:5002/api/v1/videosearch - LOGORECOGNITION_SERVER=http://192.168.2.230:9002/img_logo_recog - SCENES_SERVER=http://192.168.2.248:5003/scenes/img - FACE_SERVER=http://192.168.2.248:9015/face_recog - IP_ADDRESS=http://192.168.2.230 processor: image: cyw_multimodal-processor container_name: cyw_multimodal_processor restart: always ports: - 8866:8866 environment: - MYSQL_SERVER=192.168.2.230:13306 - MYSQL_DATABASE=multimodal - MYSQL_USER=root - MYSQL_PASSWORD=123456 - KAFKA_SERVERS_ONE=192.168.2.230:19092 - KAFKA_SERVERS_TWO=192.168.2.230:19093 - KAFKA_SERVERS_THREE=192.168.2.230:19094 - ELASTICSEARCH_SERVER=192.168.2.230:9200 - REDIS_HOST=103.59.148.101 - REDIS_PORT=6379 - REDIS_PASSWORD=jixianyuan123 - MINIO_SERVER=http://192.168.2.230:9000 - MINIO_ACCESSKEY=minio - MINIO_SECRETKEY=jxy@1314 - MINIO_BUCKET_NAME=multimodal - OCR_SERVER=http://192.168.2.230:8000/paperRecognition - ENTITY_SERVER=http://192.168.2.230:8002/entity - KEYWORD_SERVER=http://192.168.2.230:8003/keyword - ASR_SERVER=http://192.168.2.230:8004/http/gop - ABS_SERVER=http://192.168.2.230:8003/abstract - PICVECTOR_SERVER=http://192.168.2.230:5002/api/v1/index - PICSEARCH_SERVER=http://192.168.2.230:5002/api/v1/imgsearch - VIDEOSEARCH_SERVER=http://192.168.2.230:5002/api/v1/videosearch - LOGORECOGNITION_SERVER=http://192.168.2.230:9002/img_logo_recog - SCENES_SERVER=http://192.168.2.248:5003/scenes/img - FACE_SERVER=http://192.168.2.248:9015/face_recog 

原文链接:https://blog.csdn.net/qq_44213041/article/details/126486954?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994674616800197073896%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994674616800197073896&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-28-126486954-null-null.268%5Ev1%5Ekoosearch&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享