xxxxxxxxxx
[root@localhost docker-compose-jully]# mkdir mysql
[root@localhost docker-compose-jully]# cd mysql
[root@localhost mysql]#
xxxxxxxxxx
GRANT ALL PRIVILEGES ON *.* TO 'jully'@'%' WITH GRANT OPTION
xxxxxxxxxx
#1.使用MySQL Workbench或者mysqldump命令生成
#2.打开init.sql, 修改以下路径
d:/jully/jully/attachments => /home/jully/attachments
c:/jully/shore_sync/... => /home/jully/sync/...
#3.上传到 /home/docker-compose-jully/mysql
xFROM mysql
MAINTAINER jully<jully@jullytech.com>
COPY ./privileges.sql /docker-entrypoint-initdb.d/
COPY ./init.sql /docker-entrypoint-initdb.d/
xxxxxxxxxx
[root@localhost mysql]# ls
Dockerfile init.sql privileges.sql
xxxxxxxxxx
[root@localhost mysql]# docker build -t registry.cn-zhangjiakou.aliyuncs.com/jully/mysql .
Sending build context to Docker daemon 673MB
Step 1/4 : FROM mysql
latest: Pulling from library/mysql
d121f8d1c412: Already exists
f3cebc0b4691: Pull complete
1862755a0b37: Pull complete
489b44f3dbb4: Pull complete
690874f836db: Pull complete
baa8be383ffb: Pull complete
55356608b4ac: Pull complete
dd35ceccb6eb: Pull complete
429b35712b19: Pull complete
162d8291095c: Pull complete
5e500ef7181b: Pull complete
af7528e958b6: Pull complete
Digest: sha256:e1bfe11693ed2052cb3b4e5fa356c65381129e87e38551c6cd6ec532ebe0e808
Status: Downloaded newer image for mysql:latest
---> e1d7dc9731da
Step 2/4 : MAINTAINER jully<jully@jullytech.com>
---> Running in 04bccc9572dd
Removing intermediate container 04bccc9572dd
---> 56031334ca3b
Step 3/4 : COPY ./privileges.sql /docker-entrypoint-initdb.d/
---> 63e5b00603b0
Step 4/4 : COPY ./init.sql /docker-entrypoint-initdb.d/
---> 8a79d9633158
Successfully built 8a79d9633158
Successfully tagged registry.cn-zhangjiakou.aliyuncs.com/jully/mysql
xxxxxxxxxx
#1.登陆阿里云
[root@localhost docker-compose-jully]# docker login --username=liyongnanjully registry.cn-zhangjiakou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
#2.提交镜像
[root@localhost mysql]# docker push registry.cn-zhangjiakou.aliyuncs.com/jully/mysql
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/jully/mysql]
6cc2a916b2bb: Pushed
35abb57b13fe: Pushed
612c87e75ba5: Pushed
35864924eb5e: Pushed
d086c9717c2b: Pushed
2a0bd3a9cd29: Pushed
e929be3696ca: Pushed
d2055cc0a7aa: Pushed
4ff56402c7c5: Pushed
18c57f967c0e: Pushed
73b2ff2d449d: Pushed
705e0a5709e5: Pushed
99f2b905661a: Pushed
07cab4339852: Mounted from jully/nginx
1.0: digest: sha256:40bad7b12e3d8abdbd08a124baf092200870dbabec9bf804f63b3087caa2cb82 size: 3246
xxxxxxxxxx
[root@localhost docker-compose-jully]# mkdir nginx
[root@localhost docker-compose-jully]# cd nginx
[root@localhost nginx]#
xxxxxxxxxx
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://main:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
}
location /cc/websocket/ {
proxy_pass http://cc:8081/cc/websocket/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /cc {
proxy_pass http://cc:8081/cc;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
}
}
xxxxxxxxxx
FROM nginx
MAINTAINER jully<jully@jullytech.com>
COPY ./default.conf /etc/nginx/conf.d/
xxxxxxxxxx
[root@localhost nginx]# ls
default.conf Dockerfile
xxxxxxxxxx
[root@localhost nginx]# docker build -t registry.cn-zhangjiakou.aliyuncs.com/jully/nginx .
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM nginx
latest: Pulling from library/nginx
d121f8d1c412: Already exists
ebd81fc8c071: Already exists
655316c160af: Already exists
d15953c0e0f8: Already exists
2ee525c5c3cc: Already exists
Digest: sha256:c628b67d21744fce822d22fdcc0389f6bd763daac23a6b77147d0712ea7102d0
Status: Downloaded newer image for nginx:latest
---> 7e4d58f0e5f3
Step 2/3 : MAINTAINER jully<jully@jullytech.com>
---> Running in 3d1d2327f96d
Removing intermediate container 3d1d2327f96d
---> 0c1f7e7918eb
Step 3/3 : COPY ./default.conf /etc/nginx/conf.d/
---> 5c36f3e10eb9
Successfully built 5c36f3e10eb9
Successfully tagged registry.cn-zhangjiakou.aliyuncs.com/jully/nginx
xxxxxxxxxx
#1.登陆阿里云
[root@localhost docker-compose-jully]# docker login --username=liyongnanjully registry.cn-zhangjiakou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
#2.提交镜像
[root@localhost nginx]# docker push registry.cn-zhangjiakou.aliyuncs.com/jully/nginx
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/jully/nginx]
a78fd163de10: Pushed
908cf8238301: Layer already exists
eabfa4cd2d12: Layer already exists
60c688e8765e: Layer already exists
f431d0917d41: Layer already exists
07cab4339852: Layer already exists
1.0: digest: sha256:df5252084d2da5187bd4816ea321c62e96f7245acc3fc3e4010c950d08cb3ff9 size: 1569
xxxxxxxxxx
[root@localhost docker-compose-jully]# mkdir redis
[root@localhost docker-compose-jully]# cd redis/
[root@localhost redis]#
x
FROM redis
MAINTAINER jully<jully@jullytech.com>
CMD redis-server --requirepass yourpassword
xxxxxxxxxx
[root@localhost redis]# docker build -t registry.cn-zhangjiakou.aliyuncs.com/jully/redis .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM redis
latest: Pulling from library/redis
d121f8d1c412: Already exists
2f9874741855: Pull complete
d92da09ebfd4: Pull complete
bdfa64b72752: Pull complete
e748e6f663b9: Pull complete
eb1c8b66e2a1: Pull complete
Digest: sha256:1cfb205a988a9dae5f025c57b92e9643ec0e7ccff6e66bc639d8a5f95bba928c
Status: Downloaded newer image for redis:latest
---> 84c5f6e03bf0
Step 2/3 : MAINTAINER jully<jully@jullytech.com>
---> Running in 66498f0ea65b
Removing intermediate container 66498f0ea65b
---> b7c50ed5bea8
Step 3/3 : CMD redis-server --requirepass jully
---> Running in 18ce2e943eb6
Removing intermediate container 18ce2e943eb6
---> 030d8ddd5857
Successfully built 030d8ddd5857
Successfully tagged registry.cn-zhangjiakou.aliyuncs.com/jully/redis:1.0
xxxxxxxxxx
[root@localhost redis]# docker push registry.cn-zhangjiakou.aliyuncs.com/jully/redis
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/jully/redis]
2e9c060aef92: Pushed
ea96cbf71ac4: Pushed
47d8fadc6714: Pushed
7fb1fa4d4022: Pushed
45b5e221b672: Pushed
07cab4339852: Mounted from jully/nginx
1.0: digest: sha256:e8186060cb7d34850022ea4419e8daf98c3eb74c9c4e1324522fe160b22ea661 size: 1572
xxxxxxxxxx
[root@localhost docker-compose-jully]# mkdir jully-main
[root@localhost docker-compose-jully]# cd jully-main/
[root@localhost jully-main]#
x
#1.删掉以下目录
/m
/test
#2.log4j2.xml
<Property name="LOG_HOME">/home/jully/main/logs</Property>
#3.basepath.properties
temp.path=/mnt/jully/~temp
#4.version.properties
version=1.0.0.18012001 #修改成相应的版本
#5.把src打包成jully.jar,并放入lib文件夹下
/WEB-INF/lib/jully.jar
#6.使用JDK11,假设JDK的路径为D:\develop\jdk\openjdk-11
D:\jully>path D:\develop\jdk\openjdk-11\bin
#7.生成war包 (假设项目路径为 D:/jully)
D:\jully>jar -cvf jully.war .
xxxxxxxxxx
#把jully.war上传到 /home/docker-compose-jully/jully-main目录下面
[root@develop jully-main]# pwd
/home/docker-compose-develop/jully-main
[root@develop jully-main]# ls
Dockerfile jully.war
xxxxxxxxxx
FROM tomcat
MAINTAINER jully<jully@jullytech.com>
COPY ./jully.war /usr/local/tomcat/webapps/ROOT.war
xxxxxxxxxx
[root@localhost jully-main]# docker build -t registry.cn-zhangjiakou.aliyuncs.com/jully/main .
Sending build context to Docker daemon 169.7MB
Step 1/3 : FROM tomcat
latest: Pulling from library/tomcat
57df1a1f1ad8: Already exists
71e126169501: Already exists
1af28a55c3f3: Already exists
03f1c9932170: Already exists
881ad7aafb13: Already exists
9c0ffd4062f3: Already exists
bd62e479351a: Already exists
48ee8bc64dbc: Already exists
6daad3485ea7: Already exists
bc07a0199230: Already exists
Digest: sha256:c2b033c9cee06d6a3eb5a4d082935bbb8afee7478e97dcd6bc452bb6ab28da4b
Status: Downloaded newer image for tomcat:latest
---> 5f47aad0b70e
Step 2/3 : MAINTAINER jully<jully@jullytech.com>
---> Running in 665d9effcd85
Removing intermediate container 665d9effcd85
---> 527ef3a4343e
Step 3/3 : COPY ./jully.war /usr/local/tomcat/webapps/ROOT.war
---> 41ff85b7f4ee
Successfully built 41ff85b7f4ee
Successfully tagged registry.cn-zhangjiakou.aliyuncs.com/jully/main
xxxxxxxxxx
[root@localhost jully-main]# docker push registry.cn-zhangjiakou.aliyuncs.com/jully/main
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/jully/main]
17d8be887bfa: Pushed
40c5534de995: Layer already exists
236d53268ffd: Layer already exists
eb6e8fe5c6dc: Layer already exists
8b185d674aef: Layer already exists
4f17d163126f: Layer already exists
df95ed2a791d: Layer already exists
17bdf5e22660: Layer already exists
d37096232ed8: Layer already exists
6add0d2b5482: Layer already exists
4ef54afed780: Layer already exists
1.0: digest: sha256:19dfc696c848025496b5df7498108b399a33a18dc774ee850476dd0fd0d933a5 size: 2634
xxxxxxxxxx
[root@localhost docker-compose-jully]# mkdir jully-cc
[root@localhost docker-compose-jully]# cd jully-cc
[root@localhost jully-cc]#
xxxxxxxxxx
#项目打包并上传到cc目录下
[root@localhost jully-cc]# cd cc
[root@localhost cc]# ll
jully-cc.jar lib resources
[root@localhost cc]#
xxxxxxxxxx
FROM openjdk:11
COPY cc/ /usr/jully-cc/
WORKDIR /usr/jully-cc
CMD ["java","-jar","jully-cc.jar"]
xxxxxxxxxx
[root@localhost jully-cc]# docker build -t registry.cn-zhangjiakou.aliyuncs.com/jully/cc .
Sending build context to Docker daemon 72.08MB
Step 1/4 : FROM openjdk:11
11: Pulling from library/openjdk
57df1a1f1ad8: Already exists
71e126169501: Already exists
1af28a55c3f3: Already exists
03f1c9932170: Already exists
881ad7aafb13: Already exists
9c0ffd4062f3: Already exists
bd62e479351a: Already exists
Digest: sha256:a4251db6673011303dde5fe2ce76f7b90af67f63f6c6b63d7271cfbec98b9864
Status: Downloaded newer image for openjdk:11
---> 6f56b78f4e05
Step 2/4 : COPY ./cc /usr/jull-cc
---> e161133be64e
Step 3/4 : WORKDIR /usr/jully-cc
---> Running in 8062d75678d6
Removing intermediate container 8062d75678d6
---> 4cb56857c1d4
Step 4/4 : CMD ["java","-jar","jully-cc.jar"]
---> Running in db056db73122
Removing intermediate container db056db73122
---> 4c721251560c
Successfully built 4c721251560c
Successfully tagged registry.cn-zhangjiakou.aliyuncs.com/jully/cc
[root@localhost jully-cc]# docker push registry.cn-zhangjiakou.aliyuncs.com/jully/cc
The push refers to repository [registry.cn-zhangjiakou.aliyuncs.com/jully/cc]
2e340b565c82: Pushed
5530fdd4b046: Pushed
8b185d674aef: Mounted from jully/main
4f17d163126f: Mounted from jully/main
df95ed2a791d: Mounted from jully/main
17bdf5e22660: Mounted from jully/main
d37096232ed8: Mounted from jully/main
6add0d2b5482: Mounted from jully/main
4ef54afed780: Mounted from jully/main
1.0: digest: sha256:e71fdfca4115196b8ca37c0cec97ef8d8556f0f8d7402ccb8591cb7d7d2c83c3 size: 2213