docker部署安装流程

Install  Environment  Java

docker 安装jdk参考:

docker pull primetoninc/jdk:1.8

进入/etc/docker

touch daemon.json

sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker


Docker
# 首先安装 Docker
yum -y install docker

# 然后启动 Docker 服务
service docker start
 

Docker Compose

1. 下载安装包

sudo curl -L 
"https://github.com/docker/compose/releases/download/1.28.2/dock
er-compose-Linux-x86_64" -o /usr/local/bin/docker-compose

国内代理

curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

2. 设置可执⾏权限

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

3. 查看版本

docker-compose --version

创建docker-compose.yml文件    将相关配置 日志挂载出来

version: '3'
services:
#  mysql:
#    image: mysql:5.7
#    restart: always
#    volumes:
#      - /devdata/mysql/log:/var/log/mysql
#      - /devdata/mysql/data:/var/lib/mysql
#      - /devdata/mysql/conf:/etc/mysql
#    environment:
#      - MYSQL_ROOT_PASSWORD=
#    ports:
#      - 3306:3306
#
#  nacos:
#    image: nacos/nacos-server:v2.1.0
#    restart: always
#    volumes:
#      - /devdata/nacos/logs:/home/nacos/logs
#      - /devdata/nacos/conf:/home/nacos/conf
#    environment:
#      - MODE=standalone
#      - SPRING_DATASOURCE_PLATFORM=mysql
#      - MYSQL_SERVICE_HOST=
#      - MYSQL_SERVICE_PORT=3306
#      - MYSQL_SERVICE_USER=root
#      - MYSQL_SERVICE_PASSWORD=
#      - MYSQL_SERVICE_DB_NAME=nacos_config
#      - TIME_ZONE='Asia/Shanghai'
#    ports:
#      - 8848:8848
#
#  nginx:
#    image: nginx:1.21.6
#    restart: always
#    volumes:
#      - /devdata/nginx/nginx.conf:/etc/nginx/nginx.conf
#      - /devdata/nginx/conf:/etc/nginx/conf
#      - /devdata/nginx/html:/etc/nginx/html
#      - /devdata/nginx/log:/var/log/nginx
#    ports:
#      - 80:80
#      - 443:443
#
  redis:
    image: redis:6.0
    restart: always
    volumes:
      - /devdata/redis/redis.conf:/etc/redis/redis.conf
      - /devdata/redis/data:/data
      - /devdata/nginx/html:/etc/nginx/html
      - /devdata/nginx/log:/var/log/nginx
    ports:
      - 6379:6379
    command: ["redis-server","/etc/redis/redis.conf"]


#  rabbitmq:
#    image: rabbitmq:3.9
#    restart: always
#    volumes:
#      - /devdata/rabbitmq/data:/var/lib/rabbitmq
#    ports:
#      - 5672:5672
#      - 15672:15672
#
#  sentinel:
#    image: bladex/sentinel-dashboard:1.8.0
#    restart: always
#    volumes:
#      - /devdata/rabbitmq/data:/var/lib/rabbitmq
#    ports:
#      - 8858:8858
#    environment:
#      - PARAMS="--Dsentinel.dashboard.auth.username=sentinel --Dsentinel.dashboard.auth.password="
#
#  xxljob:
#    image: xuxueli/xxl-job-admin:2.3.1
#    restart: always
#    volumes:
#      - /devdata/xxljob/applogs:/data/applogs
#    ports:
#      - 8000:8080
#    environment:
#      PARAMS: "--spring.datasource.url=jdbc:mysql://...:3306/xxl_job? useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai --spring.datasource.username=root --spring.datasource.password=  --spring.datasource.driver-class-name=com.mysql.jdbc.Driver"


#  seata:
#    image: seataio/seata-server:1.4.0
#    restart: always
#    volumes:
#      - /devdata/seata/config:/root/seata-config
#    ports:
#      - 8091:8091
#    environment:
#      - SEATA_CONFIG_NAME=file:/root/seata-config/registry
#

运行 docker-compose -f ./docker-compose.yml --compatibility up -d

docker ps -a

查看以上安装服务运行状况

你可能感兴趣的:(docker,容器,运维)