docker登录到nexus连接被拒绝

时间:2017-09-20 09:44:27

标签: docker centos docker-compose nexus3

我已经设置了我的docker repo,下面是docker-compose.yml文件:

version: '2'

networks:
  prodnetwork:
    driver: bridge

services:
 nexus:
  image: sonatype/nexus3
  volumes:
   - "nexus-data:/nexus-data"
  ports:
   - "8081:8081"
   - "8082:8082"
   - "8083:8083"
   - "8084:8084"
   - "8085:8085"
   - "8086:8086"
   - "8087:8087"
   - "8088:8088"
  networks:
   - prodnetwork

 jenkins:
  image: library/jenkins
  ports:
    - "8080:8080"
  networks:
    - prodnetwork
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - /usr/bin/docker:/usr/bin/docker
    - /opt/jenkins/:/var/lib/jenkins/
  depends_on:
    - nexus
    - sonar
  environment:
    - NEXUS_PORT=8081
    - SONAR_PORT=9000
    - SONAR_DB_PORT=5432

 sonar:
  build: ./sonar
  ports:
   - "9000:9000"
   - "5432:5432"
  networks:
    - prodnetwork
  depends_on:
    - sonardb
  environment:
   - SONARQUBE_JDBC_URL=jdbc:postgresql://sonardb:5432/sonar
   - SONARQUBE_JDBC_USERNAME=sonar
   - SONARQUBE_JDBC_PASSWORD=sonar
 sonardb:
  networks:
    - prodnetwork
  image: postgres
  environment:
   - POSTGRES_USER=sonar
   - POSTGRES_PASSWORD=sonar
  volumes:
    - /opt/postgres/data:/var/lib/postgresql/data

volumes:
  nexus-data: {}

docker.service文件中,我添加了:

DOCKER_OPTS=”$DOCKER_OPTS –insecure-registry=192.168.200.150:8083″

在nexus 3中,我使用http端口创建了回购:8083和https:8123

当我尝试通过命令

登录时
docker login -u admin 192.168.200.150:8083 

8123并为nexus admin输入正确的密码:

Error response from daemon: Get https://192.168.200.150:8083/v2/: dial tcp 192.168.200.150:8083: getskopt: connection refused.

Error response from daemon: Get https://192.168.200.150:8083/v2/: http: server gave HTTP response to HTTPS client

你知道我该怎么办?我坚持不懈:/ 我正在使用 CentOs linux

2 个答案:

答案 0 :(得分:2)

对于http,编辑docker注册表,标记“在指定端口创建HTTP连接器。通常在服务器位于安全代理之后使用。” 将端口设置为8083并完成enter image description here

答案 1 :(得分:1)

几天前我自己就遇到过这个问题。如果您查看Docker Nexus 3日志,您应该看到它由于某些原因(或至少在我的情况下)无法分配给定的端口。解决这个问题的方法是查看Nexus文档并编辑jetty-https.xml,nexus.properties和org.sonatype.nexus.cfg为https://support.sonatype.com/hc/en-us/articles/217542177https://support.sonatype.com/hc/en-us/articles/231723267-How-to-Upgrade-Nexus-Repository-Manager-3-0-2-to-3-1-0-or-Later