[关闭]
@nalan90 2017-12-06T18:43:00.000000Z 字数 4026 阅读 696

Nexus for Docker config

Docker


1、启动项目

github : git@github.com:shuang1990/nexus.git

  1. work:nexus ys$ sh manager.sh run
  2. Wed Dec 6 15:20:37 CST 2017: mkdir -p /opt/data/nexus
  3. Wed Dec 6 15:20:37 CST 2017: chmod 777 /opt/data/nexus
  4. Wed Dec 6 15:20:37 CST 2017: docker run -d --restart=always -p 11681:8081 -p 11682:8082 -p 11683:8083 -v /opt/data/nexus:/nexus-data -h nexus --name nexus sonatype/nexus3
  5. [zhangshuang@jdy-pre-01 ~]$ docker ps | grep nexus
  6. b469125566ef sonatype/nexus3 "sh -c ${SONATYPE_..." 4 hours ago Up 4 hours 0.0.0.0:11681->8081/tcp, 0.0.0.0:11682->8082/tcp, 0.0.0.0:11683->8083/tcp nexus

2、添加Blob Store

image_1c0la5edu9h3ccv1lmfeo6etd9.png-119.2kB


3、添加Repositories

image_1c0la8ep68uk180t2lv10vgi6m.png-202.5kB


4、添加Roles

image_1c0laiskf19ad104715vapf7orq2a.png-137.3kB

image_1c0laknrl1fngd2d1est1o271v0u2n.png-128.8kB


5、添加Users

image_1c0lb20bvp6gq5b7d41ca31iqu34.png-114.9kB
image_1c0lb2mdm1obs5te1vmc144ofen3h.png-117.8kB


6、生成Auth Token

  1. [zhangshuang@jdy-log-01 logstash]$ docker login https://docker-9dy.sunfund.com
  2. Username (admin): admin
  3. Password:
  4. Login Succeeded
  5. [zhangshuang@jdy-log-01 logstash]$ docker login https://docker-publish-9dy.sunfund.com
  6. Username (admin): admin
  7. Password:
  8. Login Succeeded
  9. [zhangshuang@jdy-log-01 logstash]$ cat ~/.docker/config.json
  10. {
  11. "auths": {
  12. "docker-9dy.sunfund.com": {
  13. "auth": "YWRtaW46YWRtaW4xMjM="
  14. },
  15. "docker-publish-9dy.sunfund.com": {
  16. "auth": "YWRtaW46YWRtaW4xMjM="
  17. },
  18. "docker-publish.sunfund.com": {
  19. "auth": "ZG9ja2VyLXdyaXRlOmRvY2tlci13cml0ZQ=="
  20. },
  21. "docker.sunfund.com": {
  22. "auth": "ZG9ja2VyLXJlYWQ6ZG9ja2VyLXJlYWQ="
  23. }
  24. }
  25. }

7、nginx配置匿名用户无密码访问

  1. server {
  2. listen 80;
  3. server_name docker-publish-9dy.sunfund.com;
  4. access_log /var/log/nginx/docker-pub-9dy_access.log;
  5. error_log /var/log/nginx/docker-pub-9dy_error.log;
  6. return 301 https://docker-publish-9dy.sunfund.com$request_uri;
  7. }
  8. server {
  9. listen 443;
  10. server_name docker-publish-9dy.sunfund.com;
  11. access_log /var/log/nginx/docker-pub-9dy_access.log;
  12. error_log /var/log/nginx/docker-pub-9dy_error.log;
  13. # SSL
  14. ssl on;
  15. ssl_certificate ssl-cert/letsencrypt/docker-publish-9dy.sunfund.com.cer;
  16. ssl_certificate_key ssl-cert/letsencrypt/docker-publish-9dy.sunfund.com.key;
  17. # disable any limits to avoid HTTP 413 for large image uploads
  18. client_max_body_size 0;
  19. gzip on;
  20. gzip_types *;
  21. gzip_proxied any;
  22. location / {
  23. # 添加header Authorization
  24. proxy_set_header Authorization "Basic YWRtaW46YWRtaW4xMjM=";
  25. proxy_read_timeout 600;
  26. proxy_set_header X-Forwarded-Proto $scheme;
  27. proxy_redirect http:// https://;
  28. proxy_set_header Host $host;
  29. proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
  30. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  31. proxy_pass http://127.0.0.1:11683;
  32. }
  33. }
  34. server {
  35. listen 80;
  36. server_name docker-9dy.sunfund.com;
  37. access_log /var/log/nginx/docker-9dy_access.log;
  38. error_log /var/log/nginx/docker-9dy_error.log;
  39. return 301 https://docker-9dy.sunfund.com$request_uri;
  40. }
  41. server {
  42. listen 443;
  43. server_name docker-9dy.sunfund.com;
  44. access_log /var/log/nginx/docker-9dy_access.log;
  45. error_log /var/log/nginx/docker-9dy_error.log;
  46. # SSL
  47. ssl on;
  48. ssl_certificate ssl-cert/letsencrypt/docker-9dy.sunfund.com.cer;
  49. ssl_certificate_key ssl-cert/letsencrypt/docker-9dy.sunfund.com.key;
  50. # disable any limits to avoid HTTP 413 for large image uploads
  51. client_max_body_size 0;
  52. gzip on;
  53. gzip_types *;
  54. gzip_proxied any;
  55. location / {
  56. # 添加header Authorization
  57. proxy_set_header Authorization "Basic YWRtaW46YWRtaW4xMjM=";
  58. proxy_read_timeout 600;
  59. proxy_set_header X-Forwarded-Proto $scheme;
  60. proxy_redirect http:// https://;
  61. proxy_set_header Host $host;
  62. proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
  63. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  64. proxy_pass http://127.0.0.1:11682;
  65. }
  66. }
  67. server {
  68. listen 80;
  69. server_name nexus-9dy.sunfund.com;
  70. access_log /var/log/nginx/nexus_access.log;
  71. error_log /var/log/nginx/nexus_error.log;
  72. return 301 https://nexus-9dy.sunfund.com$request_uri;
  73. }
  74. server {
  75. listen 443;
  76. server_name nexus-9dy.sunfund.com;
  77. access_log /var/log/nginx/nexus_9dy_access.log;
  78. error_log /var/log/nginx/nexus_9dy_error.log;
  79. # SSL
  80. ssl on;
  81. ssl_certificate ssl-cert/letsencrypt/nexus-9dy.sunfund.com.cer;
  82. ssl_certificate_key ssl-cert/letsencrypt/nexus-9dy.sunfund.com.key;
  83. # disable any limits to avoid HTTP 413 for large image uploads
  84. client_max_body_size 0;
  85. gzip on;
  86. gzip_types *;
  87. gzip_proxied any;
  88. location / {
  89. proxy_read_timeout 600;
  90. proxy_set_header X-Forwarded-Proto $scheme;
  91. proxy_redirect http:// https://;
  92. proxy_set_header Host $host;
  93. proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
  94. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  95. proxy_pass http://127.0.0.1:11681;
  96. }
  97. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注