Docker-compose部署chemexIT资产管理系统堆栈

Docker-compose部署chemexIT资产管理系统堆栈

一、安装Docker

  1. 部署docker的yum源
cat > /etc/yum.repos.d/docker-ce.repo <<EOF
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://download.docker.com/linux/centos/$releasever/source/stable
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://download.docker.com/linux/centos/$releasever/source/test
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://download.docker.com/linux/centos/$releasever/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
EOF

yum clean
yum makecache
  1. yum安装docker
yum -y install docker-ce

二、安装docker-compose

  1. 下载二进制文件
cd /usr/src/
wget https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64
  1. 移动文件到/usr/local/bin下
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
  1. 赋予可执行权限
chmod +x /usr/local/bin/docker-compose
  1. 创建软链接
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
  1. 测试
docker-compose --version
  1. 启动docker
systemctl enable docker --now

三、拉取所需要的镜像

  1. 拉取mysql镜像
docker pull mysql:8.0
  1. 拉取chemex镜像
docker pull celaraze/chemex:latest

四、编写docker-compose.yml部署chemex

  1. 创建存放的父目录
mkdir -p /home/chemex-server
  1. 创建mysql映射的目录

/home/chemex-server/mysql/data #存放mysql的数据
/home/chemex-server/mysql/log #存放mysql的日志

cd /home/chemex-server
mkdir -p mysql/data
mkdir -p mysql/log
  1. 编写docker-compose部署文件(使用的yml格式)
cd /home/chemex-server
vim docker-compose.yml
---
version: "3"
services: 
  mysql: 
    container_name: mysql
    command: "--max_connections=1000 --wait_timeout=28800 --interactive_timeout=28800 --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci"
    environment: 
      - MYSQL_ROOT_PASSWORD=myrootpasswd
      - MYSQL_DATABASE=chemex
      - MYSQL_USER=chemex
      - MYSQL_PASSWORD=mypasswd
      - TZ=Asia/Shanghai
    expose:
      - "3306"
    image: "mysql:8.0"
    networks: 
      - chemex-net
    restart: always
    privileged: true
    volumes: 
      - "./mysql/data:/var/lib/mysql"
      - "./mysql/log:/var/log/mysql"
  chemex: 
    container_name: chemex
    links: 
      - chemex-mysql
    environment: 
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_DATABASE=chemex
      - DB_USERNAME=chemex
      - DB_PASSWORD=mypasswd
      - INSTALL=true
    image: "celaraze/chemex:latest"
    networks: 
      - chemex-net
    ports: 
      - "9876:80"  #9876修改成可以访问的端口号
    restart: always
    privileged: true
networks:
  chemex-net:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.1.0/24
          gateway: 192.168.1.1
  1. 启动docker-compose
docker-compose up -d
  1. 查看启动状态
docker-compose ps
  1. 查看容器启动日志
docker-compose log

五、浏览器访问

  1. 浏览器访问http://ip:9876
  2. 用户名admin,初始密码admin
    chemexIT资产管理系统
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

花前月下猴

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值