You must replace the baseURL in hugo.toml file when deploying, you can manage this announcement from the params.toml file.
docker-compose 定义和运行容器

docker-compose 定义和运行容器

Docker Compose 是 docker 提供的一个命令行工具,用来定义和运行由多个容器组成的应用。

Table of Contents

安装

确保本机已经安装了docker,参考官方链接:https://docs.docker.com/compose/install/

运行此命令 下载docker compose 的当前稳定版本:

sudo curl -L https://download.fastgit.org/docker/compose/releases/download/1.27.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

对二进制文件应用可执行权限

sudo chmod +x /usr/local/bin/docker-compose

创建软链接

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

查看版本测试是否安装成功

docker-compose --version

显示:docker-compose version 1.24.1, build 4667896b,则安装成功

命令

启动容器

docker-compose up -d

停止容器

docker-compose down

其它

mysql


version: "3"

services:
  mysql:
    image: mysql
    container_name: mysql
    command:
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_ROOT_HOST: '%'
      TZ: Asia/Shanghai
    ports:
      - 3306:3306
    networks:
      - adv-network
    volumes:
      - /home/docker/mysql/data:/var/lib/mysql
      - /home/docker/mysql/conf:/etc/mysql/conf.d
      - /home/docker/mysql/logs:/logs
    logging:
      options:
        max-size: "1g"

nginx

version: "3.0"

services:
    nginx:
        image: nginx:latest
        container_name: nginx
        volumes:
            - /home/docker/nginx/conf.d:/etc/nginx/conf.d
            - /home/docker/nginx/nginx.conf:/etc/nginx/nginx.conf
            - /home/docker/nginx/logs:/var/log/nginx
            - /home/docker/nginx/www:/usr/share/nginx
        environment:
            TZ: Asia/Shanghai
        ports:
            - "80:80"
            - "443:443"
        restart: always
        logging:
            options:
                max-size: "1g"

rabbitmq

version: "3"

services:
  rabbitmq:
      image: rabbitmq:management-alpine
      container_name: rabbitmq
      restart: always
      environment:
        RABBITMQ_DEFAULT_USER: root
        RABBITMQ_DEFAULT_PASS: 123456
        TZ: Asia/Shanghai
      ports:
        - 5672:5672
        - 15672:15672
      networks:
        - adv-network
      volumes:
        - /home/docker/rabbitmq/data:/var/lib/rabbitmq
        - /home/docker/rabbitmq/log:/var/log/rabbitmq
      logging:
        options:
          max-size: "1g"

mongo


version: "3"

services:
  mongodb:
    image: mongo:4.4.0
    container_name: mongodb
    restart: always
    environment:
        - MONGO_INITDB_ROOT_USERNAME=admin
        - MONGO_INITDB_ROOT_PASSWORD=1234567
    volumes:
        - /home/docker/mongodb/data:/data/db
        - /home/docker/mongodb/logs:/data/logs
    ports:
        - 27017:27017
Tags :
comments powered by Disqus

Related Posts

How to build an Application with modern Technology

How to build an Application with modern Technology

Nemo vel ad consectetur namut rutrum ex, venenatis sollicitudin urna. Aliquam erat volutpat.

Read More
screen 窗口管理器

screen 窗口管理器

Linux Screen是一个全屏窗口管理器,它可以创建多个窗口,并在其间进行切换。

Read More
How to build an Application with modern Technology

How to build an Application with modern Technology

Nemo vel ad consectetur namut rutrum ex, venenatis sollicitudin urna. Aliquam erat volutpat.

Read More