docker-compose安装,把docker-compose二进制文件上传到服务器

1.cp docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
2.chmod 755 /usr/local/bin/docker-compose

docker-compose常用命令

docker-compose                # 拉取镜像
docker-compose up -d nginx    # 运行nginx容器
docker-compose up -d          # 运行所有容器
docker-compose ps             # 查看容器运行状态
docker-compose down           # 停止容器和容器网络
docker-compose rm nginx       # 删除nginx容器

docker-compose.yml文件配置

version: '3'
services:
  nginx:
    image: nginx:1.19.2
    restart: always
    container_name: dm_nginx
    ports: 
      - 9000:80
    volumes:
      - /root/data-manager/nginx/html:/etc/nginx/html
      - /root/data-manager/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      - /root/data-manager/nginx/conf/conf.d:/etc/nginx/conf.d
      - /root/data-manager/nginx/logs:/var/log/nginx

  zookeeper:
    image: zookeeper:3.6.3
    restart: always
    container_name: dm_zookeeper
    ports:
      - 2181:2181
      - 8081:8080
    volumes:
      - /root/data-manager/zookeeper/data:/data
      - /root/data-manager/zookeeper/datalog:/datalog
  
  postgis:
    image: postgis/postgis:latest
    restart: always
    container_name: dm_postgis
    ports:
      - 5432:5432
    volumes:
      - /root/data-manager/postgis/data:/var/lib/postgresql/data
    environment:
      POSTGIS_USER: postgres
      POSTGRES_PASSWORD: 123456
      LANG: en_US.utf8
      TZ: Asia/shanghai
  

  search:
    image: dm_search:transwarp-6.2.2
    container_name: dm_search
    privileged: true
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - /root/data-manager/search/data:/var/data/search1
      - /root/data-manager/search/logs:/var/log/search1
      - /root/data-manager/search/config/jvm.options:/usr/lib/elasticsearch/elasticsearch-5.4.1-transwarp/config/jvm.options
      - /root/data-manager/search/config/elasticsearch.yml:/usr/lib/elasticsearch/elasticsearch-5.4.1-transwarp/config/elasticsearch.yml

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐