赞
踩
- #更新至最新的库
- yum update
-
- #安装Docker
- yum install docker
-
- #启动Docker
- systemctl start docker
-
- #开机启动Docker
- systemctl enable docker
Docker默认镜像源下载太慢,可以调整为国内镜像源
- #编辑配置文件
- vi /etc/docker/daemon.json
-
- #添加镜像地址信息
- {
- "registry-mirrors": [
- "http://hub-mirror.c.163.com",
- "https://docker.mirrors.ustc.edu.cn",
- "https://registry.docker-cn.com"
- ]
- }
-
- #重启Docker
- systemctl restart docker
为了验证是否切换成功,可以使用docker info
查看,会显示如下信息:
- Registry Mirrors:
- http://hub-mirror.c.163.com
- https://docker.mirrors.ustc.edu.cn
- https://registry.docker-cn.com
安装Docker-Compose,这里下载的是最新版本v2.5.0,安装流程如下:
- #下载安装文件,其中uname -s是获取系统内核,uname -m获取系统版本,所以最后其实是下载docker-compose-Linux-x86_64
- sudo curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
-
- #添加可执行权限
- sudo chmod +x /usr/local/bin/docker-compose
-
- #检查版本,是否安装成功
- docker-compose --version
- docker run -d -i \
- --name mysql \
- -v /home/mysql/datadir:/var/lib/mysql \
- -v /home/mysql/conf.d:/etc/mysql/conf.d \
- -v /etc/localtime:/etc/localtime \
- --privileged=true \
- -p 3306:3306 \
- -e MYSQL_ROOT_PASSWORD=root \
- --restart=always \
- mysql:8.0
修改密码:
- #进入容器
- docker exec -it mysql /bin/bash
- #登录mysql
- mysql -u root -p
- #修改登录权限
- ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
select NOW()
时间如果小了8小时,执行如下操作同步时区即可:
- docker cp /usr/share/zoneinfo/Asia/Shanghai mysql:/usr/share/zoneinfo/Asia
-
- docker exec -it mysql bash
-
- cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
-
- docker restart mysql
如果要安装MySQL5.7,可按照如下安装流程执行:
- docker run -it --name mysql -d \
- -p 3306:3306 --restart=always \
- -e MYSQL_ROOT_PASSWORD=123456 \
- mysql:5.7
安装Nacos,默认采用的是Derby数据库存储,如果想用MySQL存储,需要先获取SQL脚本,并创建数据库,我们可以下载安装包获取SQL脚本,将conf/nacos_config.sql
导入数据库即可。
下载地址:Releases · alibaba/nacos · GitHub
安装脚本:
- docker run -d \
- -e MODE=standalone \
- -e SPRING_DATASOURCE_PLATFORM=mysql \
- -e MYSQL_SERVICE_HOST=192.168.211.130 \
- -e MYSQL_SERVICE_PORT=3306 \
- -e MYSQL_SERVICE_USER=root \
- -e MYSQL_SERVICE_PASSWORD=123456 \
- -e MYSQL_SERVICE_DB_NAME=nacos_config \
- -p 8848:8848 \
- --restart=always \
- --name nacos nacos/nacos-server:v2.1.0
安装OpenResty需要先安装相关依赖库:
yum install libtermcap-devel ncurses-devel libevent-devel readline-devel pcre-devel gcc openssl openssl-devel per perl wget
安装OpenResty
- #下载OpenResty
- wget https://openresty.org/download/openresty-1.11.2.5.tar.gz
-
- #解压OpenResty
- tar -xf openresty-1.11.2.5.tar.gz
-
- #配置 OpenResty
- ./configure --prefix=/usr/local/openresty --with-luajit --without-http_redis2_module --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module
-
- #编译安装
- make && make install
-
- #在profile中添加环境配置
- vi /etc/profile
Nginx服务自启
创建/etc/systemd/system/nginx.service
,添加如下配置:
- [Unit]
- Description=nginx service
- After=network.target
-
- [Service]
- Type=forking
- ExecStart=/usr/local/openresty/nginx/sbin/nginx
- ExecReload=/usr/local/openresty/nginx/sbin/nginx -s reload
- ExecStop=/usr/local/openresty/nginx/sbin/nginx -s quit
-
- PrivateTmp=true
-
- [Install]
- WantedBy=multi-user.target
保存退出后,然后执行服务配置加载,并设置开机启动,同时可以验证一下命令是否生效,操作如下:
- #重新加载服务配置
- systemctl daemon-reload
-
- #Nginx开机启动
- systemctl enable nginx
-
- #nginx启动:
- systemctl start nginx
-
- #nginx停止:
- systemctl stop nginx
-
- #重启 验证是否开机自启
- reboot
安装Redis,这里固定版本为6.2.4,操作如下:
- docker run -itd --name redis -p 6379:6379 \
- --privileged=true \
- -v /usr/local/docker/redis/data:/data \
- -v /usr/local/docker/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf \
- --restart=always \
- redis:6.2.4 --requirepass 123456
Kafka集群需要使用Zookeeper实现分布式管理,我们先拉去Zookeeper镜像,再实现安装:
docker pull zookeeper:3.7.0
创建脚本文件kafka.yml
version: '3.8' services: zookeeper: image: zookeeper:3.7.0 restart: always hostname: 192.168。211.130 container_name: zookeeper privileged: true ports: - 2181:2181 volumes: - /usr/local/server/zookeeper/data/:/data build: context: . network: host kafka1: container_name: kafka1 restart: always image: wurstmeister/kafka:2.12-2.5.0 privileged: true ports: - 9092:9092 - 19092:19092 environment: KAFKA_BROKER_ID: 1 HOST_IP: 192.168.211.130 KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.211.130:9092 ## 宿主机IP KAFKA_ZOOKEEPER_CONNECT: 192.168.211.130:2181 #docker部署必须设置外部可访问ip和端口,否则注册进zk的地址将不可达造成外部无法连接 KAFKA_ADVERTISED_HOST_NAME: 192.168.211.130 KAFKA_ADVERTISED_PORT: 9092 KAFKA_PORT: 9092 KAFKA_delete_topic_enable: 'true' KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.211.130 -Dcom.sun.management.jmxremote.rmi.port=19092" JMX_PORT: 19092 volumes: /etc/localtime:/etc/localtime depends_on: zookeeper kafka2: container_name: kafka2 restart: always image: wurstmeister/kafka:2.12-2.5.0 privileged: true ports: - 9093:9093 - 19093:19093 environment: KAFKA_BROKER_ID: 2 HOST_IP: 192.168.211.130 KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9093 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.211.130:9093 ## 宿主机IP KAFKA_ZOOKEEPER_CONNECT: 192.168.211.130:2181 #docker部署必须设置外部可访问ip和端口,否则注册进zk的地址将不可达造成外部无法连接 KAFKA_ADVERTISED_HOST_NAME: 192.168.211.130 KAFKA_ADVERTISED_PORT: 9093 KAFKA_PORT: 9093 KAFKA_delete_topic_enable: 'true' KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.211.130 -Dcom.sun.management.jmxremote.rmi.port=19093" JMX_PORT: 19093 volumes: /etc/localtime:/etc/localtime depends_on: zookeeper kafka3: container_name: kafka3 restart: always image: wurstmeister/kafka:2.12-2.5.0 privileged: true ports: - 9094:9094 - 19094:19094 environment: KAFKA_BROKER_ID: 3 HOST_IP: 192.168.211.130 KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9094 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.211.130:9094 ## 宿主机IP KAFKA_ZOOKEEPER_CONNECT: 192.168.211.130:2181 #docker部署必须设置外部可访问ip和端口,否则注册进zk的地址将不可达造成外部无法连接 KAFKA_ADVERTISED_HOST_NAME: 192.168.211.130 KAFKA_ADVERTISED_PORT: 9094 KAFKA_PORT: 9094 KAFKA_delete_topic_enable: 'true' KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.211.130 -Dcom.sun.management.jmxremote.rmi.port=19094" JMX_PORT: 19094 volumes: /etc/localtime:/etc/localtime depends_on: zookeeper eagle: image: gui66497/kafka_eagle container_name: eagle_monitor restart: always depends_on: - kafka1 - kafka2 - kafka3 ports: - "8048:8048" environment: ZKSERVER: "192.168.211.130:2181"
执行安装;
- #执行命令
- docker-compose -f kafka.yml up -d
-
- #效果如下
- [root@localhost kafka]# docker-compose -f kafka.yml up -d
- [+] Running 5/5
- ⠿ Container kafka2 Started 1.1s
- ⠿ Container kafka3 Started 1.2s
- ⠿ Container zookeeper Started 1.0s
- ⠿ Container kafka1 Started 1.1s
- ⠿ Container eagle_monitor Started 3.0s
- [root@localhost kafka]#
访问控制台http://192.168.211.130:8048/ke/
,输入账号密码admin / 123456
登录,效果如下:
采用Docker方式安装ElasticSearch:
- docker run -i --name elasticsearch -d \
- --restart=always -p 9200:9200 -p 9300:9300 \
- --privileged=true \
- -v /usr/local/server/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
- -e "discovery.type=single-node" \
- elasticsearch:7.12.1
IK分词器安装,下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases?page=4 下载后,将压缩包拷贝到 /usr/local/server/elasticsearch/plugins
目录下,操作如下:
#解压需要用到unzip,如果没有安装它,可以先安装yum install unzip#解压文件unzip elasticsearch-analysis-ik-7.10.1.zip -d ./ik#重新启动elasticsearch,IK分词器就生效docker restart elasticsearch
elasticsearch-hq
是一个非常方便的Elasticsearch可视化管理工具,我们可以安装一个:
docker run -id -p 5000:5000 --restart=always elastichq/elasticsearch-hq
安装完成后,访问http://192.168.211.130:5000/即可。
Kibana也是一款非常不错的Elasticsearch管理工具,我们也可以安装它:
- #进入容器
- docker exec -it kibana /bin/bash
-
- #编辑config/kibana.yml,修改中文,添加下面配置即可
- i18n.locale: "zh-CN"
-
- #重启容器
- docker restart kibana
MinIO基于Apache License v2.0开源协议的对象存储服务,可以做为云存储的解决方案用来保存海量的图片,视频,文档。由于采用Golang实现,服务端可以工作在Windows,Linux, OS X和FreeBSD上。配置简单,基本是复制可执行程序,单行命令可以运行起来。
关于MinIOn使用参考文档 MinIO Quickstart Guide| Minio中文文档
我们可以使用docker进行环境部署和启动
- docker run -i -d \
- -p 9000:9000 \
- -p 9001:9001 \
- --restart=always \
- --name minio1 \
- --privileged=true \
- -v /etc/localtime:/etc/localtime \
- -v ~/minio/data:/data \
- -e "MINIO_ROOT_USER=minio" \
- -e "MINIO_ROOT_PASSWORD=minio123" \
- minio server /data --console-address ":9001"
访问:http://192.168.211.130:9000/login 输入账号 minio / minio123即可登录。
创建Buckets:
Buckets权限管理
上传图片测试:
如果所有文件都存储到shop下,不容易区分,我们可以根据不同文件,创建不同目录,例如shop/items/
存储所有商品静态页,多级路径创建:
选择Upload
上传文件:
文件访问:http://192.168.211.130:9000/shop/items/002.jpg
效果如下:
如果是java程序抛出异常,主要是时间不同步问题:
The difference between the request time and the server's time is too large.
解决方案如下:
- #安装ntp ntpdate
- yum -y install ntp ntpdate
-
- #与时间服务器同步时间
- ntpdate cn.pool.ntp.org
-
- #将系统时间写入硬件时间
- hwclock --systohc
安装FastDFS需要安装Tracker和Storage:
- #Tracker安装
- docker run -d --name tracker --restart=always \
- --net=host morunchang/fastdfs \
- sh tracker.sh
-
- #Storage安装
- docker run -d --name storage \
- --restart=always --net=host -e \
- TRACKER_IP=192.168.211.130:22122 \
- -e GROUP_NAME=group1 morunchang/fastdfs \
- sh storage.sh
canal 1.1.4
版本,迎来最重要的WebUI
能力,引入canal-admin
工程,支持面向WebUI
的canal
动态管理能力,支持配置、任务、日志等在线白屏运维能力。
不过当前已经更新到了最新版本1.1.6,但1.1.6属于测试版,1.1.5属于稳定版,所以我们安装1.1.5。
- docker run -p 11111:11111 --name=canal \
- --restart=always -d \
- canal/canal-server:v1.1.5
安装命令:
- # 1. 卸载旧版本
- yum remove git
-
- # 2. 安装 yum 源的 Git 版本
- yum install -y git
-
- # 3. 查看版本
- git version
- # 输出 git version 1.8.3.1
- docker run --name seata1 -d \
- -p 8091:8091 -e SEATA_PORT=8091 \
- --privileged=true -e SEATA_IP=192.168.211.131 \
- -v /usr/local/server/seata1/conf:/root/seata-config \
- -v /usr/local/server/seata1/logs:/root/logs/seata \
- seataio/seata-server:1.4.2
修改注册中心
#1)进入容器 docker exec -it seata1 sh #2)进入resources cd resources/ #3)修改配置中心和注册中心 registry { # file ...nacos ...eureka...redis...zk...consul...etcd3...sofa type = "nacos" nacos { application = "seata-tc-server" serverAddr = "192.168.211.131:8848" group = "SEATA_GROUP" namespace = "" cluster = "default" username = "nacos" password = "nacos" } } config { # file...nacos ...apollo...zk...consul...etcd3 type = "nacos" nacos { serverAddr = "192.168.211.131:8848" namespace = "" group = "SEATA_GROUP" username = "nacos" password = "nacos" dataId = "seataServer.properties" } } #4)退出,修改 exit #5)修改Nacos,添加seataServer.properties,内容如下: # 数据存储方式,db代表数据库 store.mode=db store.db.datasource=druid store.db.dbType=mysql store.db.driverClassName=com.mysql.jdbc.Driver store.db.url=jdbc:mysql://192.168.211.131:3306/seata?useUnicode=true&rewriteBatchedStatements=true store.db.user=root store.db.password=123456 store.db.minConn=5 store.db.maxConn=30 store.db.globalTable=global_table store.db.branchTable=branch_table store.db.queryLimit=100 store.db.lockTable=lock_table store.db.maxWait=5000 # 事务、日志等配置 server.recovery.committingRetryPeriod=1000 server.recovery.asynCommittingRetryPeriod=1000 server.recovery.rollbackingRetryPeriod=1000 server.recovery.timeoutRetryPeriod=1000 server.maxCommitRetryTimeout=-1 server.maxRollbackRetryTimeout=-1 server.rollbackRetryTimeoutUnlockEnable=false server.undo.logSaveDays=7 server.undo.logDeletePeriod=86400000 # 客户端与服务端传输方式 transport.serialization=seata transport.compressor=none # 关闭metrics功能,提高性能 metrics.enabled=false metrics.registryType=compact metrics.exporterList=prometheus metrics.exporterPrometheusPort=9898 #6)创建seata数据库,并将如下脚本导入到数据库中 SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- 分支事务表 -- ---------------------------- DROP TABLE IF EXISTS `branch_table`; CREATE TABLE `branch_table` ( `branch_id` bigint(20) NOT NULL, `xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `transaction_id` bigint(20) NULL DEFAULT NULL, `resource_group_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `resource_id` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `branch_type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `status` tinyint(4) NULL DEFAULT NULL, `client_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `gmt_create` datetime(6) NULL DEFAULT NULL, `gmt_modified` datetime(6) NULL DEFAULT NULL, PRIMARY KEY (`branch_id`) USING BTREE, INDEX `idx_xid`(`xid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- 全局事务表 -- ---------------------------- DROP TABLE IF EXISTS `global_table`; CREATE TABLE `global_table` ( `xid` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, `transaction_id` bigint(20) NULL DEFAULT NULL, `status` tinyint(4) NOT NULL, `application_id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `transaction_service_group` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `transaction_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `timeout` int(11) NULL DEFAULT NULL, `begin_time` bigint(20) NULL DEFAULT NULL, `application_data` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `gmt_create` datetime NULL DEFAULT NULL, `gmt_modified` datetime NULL DEFAULT NULL, PRIMARY KEY (`xid`) USING BTREE, INDEX `idx_gmt_modified_status`(`gmt_modified`, `status`) USING BTREE, INDEX `idx_transaction_id`(`transaction_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; SET FOREIGN_KEY_CHECKS = 1; #7)重启容器 docker restart seata1
此时查看Nacos中的服务注册数据,能看到seata服务注册数据:
安装命令如下:
- docker run -d --hostname host130 \
- --name rabbitMq \
- -e RABBITMQ_DEFAULT_USER=admin \
- -e RABBITMQ_DEFAULT_PASS=123456 \
- -p 15672:15672 \
- -p 5672:5672 \
- --restart=always \
- rabbitmq:3.8.2-management
参数说明:
- -d 以守护进程方式在后台运行
- -p 15672:15672 management 界面管理访问端口
- -p 5672:5672 amqp 访问端口
- --name:指定容器名
- --hostname:设定容器的主机名,它会被写到容器内的 /etc/hostname 和 /etc/hosts,作为容器主机IP的别名,并且将显示在容器的bash中,所以记得将host130添加到/etc/hosts下面,如下:
- #127.0.0.1 host130
-
- -e 参数
- RABBITMQ_DEFAULT_USER 用户名
- RABBITMQ_DEFAULT_PASS 密码
输入http://192.168.211.130:15672/ 访问,账号admin,密码123456,或者guest/guest
安装RocketMQ需要安装mqnamesrv和broker,安装流程如下:
#创建存储日志目录 mkdir -p /usr/local/server/rocketmq/data/namesrv/logs /usr/local/server/rocketmq/data/namesrv/store #安装mqnamesrv docker run -d \ --restart=always \ --name rmqnamesrv \ -p 9876:9876 \ -v /usr/local/server/rocketmq/data/namesrv/logs:/root/logs \ -v /usr/local/server/rocketmq/data/namesrv/store:/root/store \ -e "MAX_POSSIBLE_HEAP=100000000" \ rocketmqinc/rocketmq \ sh mqnamesrv #创建目录存储broker日志信息和配置文件 mkdir -p /usr/local/server/rocketmq/data/broker/logs /usr/local/server/rocketmq/data/broker/store /usr/local/server/rocketmq/conf #创建配置文件 vi /usr/local/server/rocketmq/conf/broker.conf #配置文件完整内容如下 # 所属集群名称,如果节点较多可以配置多个 brokerClusterName = DefaultCluster #broker名称,master和slave使用相同的名称,表明他们的主从关系 brokerName = broker-a #0表示Master,大于0表示不同的slave brokerId = 0 #表示几点做消息删除动作,默认是凌晨4点 deleteWhen = 04 #在磁盘上保留消息的时长,单位是小时 fileReservedTime = 48 #有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制; brokerRole = ASYNC_MASTER #刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要; flushDiskType = ASYNC_FLUSH # 设置broker节点所在服务器的ip地址 brokerIP1 = 192.168.211.130 # 磁盘使用达到95%之后,生产者再写入消息会报错 CODE: 14 DESC: service not available now, maybe disk full diskMaxUsedSpaceRatio=95 #创建broker docker run -d \ --restart=always \ --name rmqbroker \ --link rmqnamesrv:namesrv \ -p 10911:10911 \ -p 10909:10909 \ -v /usr/local/server/rocketmq/data/broker/logs:/root/logs \ -v /usr/local/server/rocketmq/data/broker/store:/root/store \ -v /usr/local/server/rocketmq/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf \ -e "NAMESRV_ADDR=namesrv:9876" \ -e "MAX_POSSIBLE_HEAP=200000000" \ rocketmqinc/rocketmq \ sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf #创建控制台console docker run -d \ --restart=always \ --name rmqadmin \ -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.211.130:9876 \ -Dcom.rocketmq.sendMessageWithVIPChannel=false" \ -p 9999:8080 \ pangliang/rocketmq-console-ng
以IgeMonitor为例,使用Dockerfile构建,Dockerfile文件如下:
- FROM openjdk:11-jre
- LABEL maintainer="研究院研发组 shenkunlin@itcast.cn"
- RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
- ADD ./ige-monitor-igem-1.0.jar /app.jar
- ENV dbuname="root"
- ENV dbpwd="root"
- ENV dbname="ige_config"
- ENV dburl="localhost:3306"
- ENV iport="8085"
- WORKDIR /
- ENTRYPOINT ["sh","-c","java -jar -Ddbuname=$dbuname -Ddbpwd=$dbpwd -Ddbname=$dbname -Ddburl=$dburl -Diport=$iport -Xms512m -Xmx512m -XX:PermSize=512M -XX:MaxPermSize=512m /app.jar"]
构建镜像:
docker build -t igemonitor:2.0 .
安装容器:
- docker run -it -d --name=igemonitor \
- -p 8085:8085 -p 28888:28888 \
- --restart=always \
- -e dbuname=root \
- -e dbpwd=123456 \
- -e dburl=192.168.211.131:3306 \
- igemonitor:2.0
Dockerhub地址:Docker Hub,如果想将自己制作的镜像发布上去,首先可以注册一个DockerHub账号:dockershenkunlin
,密码:***********
1)创建仓库
2)镜像推送
#查看本地容器 [root@localhost igemonitor]# docker ps CONTAINER ID IMAGE NAMES 4eecde9ee7f6 igemonitor:1.0 igemonitor #并提交容器制作成本地镜像 docker commit igemonitor dockershenkunlin/igemonitor:v1.0 #登录dockerhub [root@localhost igemonitor]# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: dockershenkunlin Password: Login Succeeded #将本地镜像推送至Dockerhub docker push dockershenkunlin/igemonitor:1.0
我们可以看到镜像已经推送至Dockerhub了,如下图:
3)镜像下载安装测试
记得先清除本地Docker镜像,再执行如下操作安装镜像:
- docker run -it -d --name=igemonitor \
- -p 8085:8085 -p 28888:28888 \
- --restart=always \
- -e dbuname=root \
- -e dbpwd=123456 \
- -e dburl=192.168.211.130:3306 \
- dockershenkunlin/igemonitor:v1.0
效果如下:
安装完成后,访问http://192.168.211.130:8085/效果如下:
mvn install:install-file -Dfile=E:\ige-rpc-client-igem-1.0.jar -DgroupId=com.itheima -DartifactId=ige-rpc-client -Dversion=igem-1.0 -Dpackaging=jar
效果如下:
运行程序出现如下错误:
出现这个的原因一般是因为项目需要打印的环境变量太长,超过了限制,需要你缩短命令行来解决问题。解决这个问题,只需要修改工作空间中的配置即可。
- #在项目的.idea/workspace.xml文件中,找到
- <component name="PropertiesComponent">
-
- #后面在添加下面一行配置即可,这种方式一次设置就行。
- <property name="dynamic.classpath" value="true" />
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。