一些docker实例

Table of Contents

redis

version: '3'
services:
  redis:
    image: redis:latest
    container_name: docker_redis
    volumes:
      - ./data:/data
      - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
      - ./logs:/logs
    command:
      "redis-server /usr/local/etc/redis/redis.conf"
    ports:
      - 6379:6379

rabbitmq

version: "2"
services:
  rabbitmq:
    image: rabbitmq:3-management
    container_name: rabbitmq
    ports:
      - 5672:5672
      - 15672:15672

nginx

version: "2"
services:
  docker_nginx:
    image: nginx:latest
    container_name: docker_nginx
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./conf.d:/etc/nginx/conf.d
    ports:
      - 80:80

mysql

5.7.52

version: "2"
services:
  mysql:
    image: mysql:5.7.32
    container_name: docker_mysql_local
    ports:
      - 3306:3306
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - ./mysql57/conf:/etc/mysql/conf.d
      - ./mysql57/logs:/logs
      - ./data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: Asdf1234

8.0.19

version: "2"
services:
  mysql:
    image: mysql:8.0.19
    container_name: docker_mysql_8019
    ports:
      - 3406:3306
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - ./mysql8019/conf:/etc/mysql/conf.d
      - ./mysql8019/logs:/logs
      - ./mysql8019/data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: Asdf1234

mongodb

# Use root/example as user/password credentials
version: '3.6'
services:
  mongo:
    image: mongo
    ports:
      - 27017:27017
    volumes:
      - ./db:/data/db
      - ./custom:/etc/mongo
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

memcached

version: "2"
services:
  rabbitmq:
    image: memcached:latest
    container_name: memcached
    ports:
      - 11211:11211

kfk

kfk-manager

version: '3'
services:
  kafkamanager:
    image: sheepkiller/kafka-manager
    container_name: sheepkiller_kafka_manager
    ports:
      - "9000:9000"
    environment:
      ZK_HOSTS: 172.16.0.46:2181

kfk

  version: '3'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    container_name: wurstmeister_zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka
    container_name: wurstmeister_kafka
    depends_on: [ zookeeper ]
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 172.16.0.46
      KAFKA_CREATE_TOPICS: "test:1:1"
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
    volumes:
      - ~/docker_workspace/docker_kfk/data/kafka/docker.sock:/var/run/docker.sock

eureka

version: '3'
services:
  eureka:
    image: springcloud/eureka:latest
    container_name: springcloud_eureka
    ports:
      - "8761:8761"

ghost博客1

version: '3'
services:
ghost_0633_blog:
    image: diancloud/ghost:0.6.3-zh
    restart: always
    ports:
      - 127.0.0.1:9010:2368
    volumes:
      - /home/js/workspace_ghost/ghost_0633_blog:/ghost-override
    environment:
      url: https://xxx.com

ghost博客2

  • vim docker-compose.yml

version: '3'
services:
ghost_0633_blog:
    image: diancloud/ghost:0.6.3-zh
    restart: always
    ports:
      - 127.0.0.1:9010:2368
    volumes:
      - /home/js/workspace_ghost/ghost_0633_blog:/ghost-override
    environment:
      url: https://xxx.com/blog1

修改config.js

  • vim /home/js/workspace_ghost/ghost_0633_blog/config.js

config = {
    / ### Production
    /
When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
            url: 'http://xxx.com/blog',2

Footnotes:

1

url域名后跟上/blog。

2

config.production.url 必须是http协议。

Date: 2021-08-24 二 23:59