Docker使用错误的JDK突然为Jenkins编写了代码?

时间:2018-09-24 15:25:16

标签: docker jenkins docker-compose

我有以下docker-compose.yml文件,该文件仅在Mac上的Docker容器中运行Jenkins

jenkins:
  image: bechhansen/jenkins-aws
  container_name: jenkins-aws
  ports:
    - 8081:8080
  volumes:
    - ./home:/var/jenkins_home

我能够在两天前运行它,也就是说,我能够在localhost:8081上访问Jenkins

今天,当我尝试运行它时,我得到了

$ docker-compose up
Starting jenkins-aws ... done
Attaching to jenkins-aws
jenkins-aws | Sep 24, 2018 3:17:22 PM Main main
jenkins-aws | SEVERE: Running with Java class version 51.0, which is older than the required 52.0. See https://jenkins.io/redirect/java-support/
jenkins-aws | java.lang.UnsupportedClassVersionError: 51.0
jenkins-aws |   at Main.main(Main.java:146)
jenkins-aws | 
jenkins-aws | Jenkins requires Java 8, but you are running 1.7.0_181-b01 from /usr/lib/jvm/java-7-openjdk-amd64/jre
jenkins-aws | java.lang.UnsupportedClassVersionError: 51.0
jenkins-aws |   at Main.main(Main.java:146)
jenkins-aws exited with code 0

或更详细的输出

$ docker-compose --verbose up
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/Users/cfouts/.docker/config.json', '/Users/cfouts/.dockercfg']
docker.utils.config.find_config_file: Found file at path: /Users/cfouts/.docker/config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Auth data for https://803597461034.dkr.ecr.us-east-1.amazonaws.com is absent. Client might be using a credentials store instead.
docker.auth.parse_auth: Auth data for 803597461034.dkr.ecr.us-east-1.amazonaws.com is absent. Client might be using a credentials store instead.
docker.auth.load_config: Found 'credsStore' section
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/version HTTP/1.1" 200 568
compose.cli.command.get_client: docker-compose version 1.22.0, build f46880f
docker-py version: 3.4.1
CPython version: 3.6.4
OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018
compose.cli.command.get_client: Docker base_url: http+docker://localhost
compose.cli.command.get_client: Docker version: Platform={'Name': ''}, Components=[{'Name': 'Engine', 'Version': '18.06.1-ce', 'Details': {'ApiVersion': '1.38', 'Arch': 'amd64', 'BuildTime': '2018-08-21T17:29:02.000000000+00:00', 'Experimental': 'true', 'GitCommit': 'e68fc7a', 'GoVersion': 'go1.10.3', 'KernelVersion': '4.9.93-linuxkit-aufs', 'MinAPIVersion': '1.12', 'Os': 'linux'}}], Version=18.06.1-ce, ApiVersion=1.38, MinAPIVersion=1.12, GitCommit=e68fc7a, GoVersion=go1.10.3, Os=linux, Arch=amd64, KernelVersion=4.9.93-linuxkit-aufs, Experimental=True, BuildTime=2018-08-21T17:29:02.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/info HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker info -> {'Architecture': 'x86_64',
 'BridgeNfIp6tables': True,
 'BridgeNfIptables': True,
 'CPUSet': True,
 'CPUShares': True,
 'CgroupDriver': 'cgroupfs',
 'ClusterAdvertise': '',
 'ClusterStore': '',
 'ContainerdCommit': {'Expected': '468a545b9edcd5932818eb9de8e72413e616e86e',
                      'ID': '468a545b9edcd5932818eb9de8e72413e616e86e'},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=jenkins-aws', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Djenkins-aws%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=jenkinsaws', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Djenkinsaws%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=jenkins-aws', 'com.docker.compose.service=jenkins', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Djenkins-aws%22%2C+%22com.docker.compose.service%3Djenkins%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 1388
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['--', '/usr/local/bin/jenkins.sh'],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/bin/tini', '--', '/usr/local/bin/jenkins.sh'],
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('bechhansen/jenkins-aws')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/images/bechhansen/jenkins-aws/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {'Architecture': 'amd64',
 'Author': '',
 'Comment': '',
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/bin/tini', '--', '/usr/local/bin/jenkins.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=jenkins-aws', 'com.docker.compose.service=jenkins', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Djenkins-aws%22%2C+%22com.docker.compose.service%3Djenkins%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 1388
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('bechhansen/jenkins-aws')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/images/bechhansen/jenkins-aws/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {'Architecture': 'amd64',
 'Author': '',
 'Comment': '',
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/bin/tini', '--', '/usr/local/bin/jenkins.sh'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['--', '/usr/local/bin/jenkins.sh'],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/bin/tini', '--', '/usr/local/bin/jenkins.sh'],
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...
compose.parallel.feed_queue: Pending: {<Service: jenkins>}
compose.parallel.feed_queue: Starting producer thread for <Service: jenkins>
Starting jenkins-aws ... 
compose.parallel.feed_queue: Pending: {<Container: jenkins-aws (0ff957)>}
compose.parallel.feed_queue: Starting producer thread for <Container: jenkins-aws (0ff957)>
compose.cli.verbose_proxy.proxy_callable: docker attach <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5', stdout=True, stderr=True, stream=True)
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/attach?logs=0&stdout=1&stderr=1&stream=1 HTTP/1.1" 101 0
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker attach -> <docker.types.daemon.CancellableStream object at 0x11127b0b8>
compose.cli.verbose_proxy.proxy_callable: docker start <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5')
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/start HTTP/1.1" 204 0
compose.cli.verbose_proxy.proxy_callable: docker start -> None
compose.parallel.parallel_execute_iter: Finished processing: <Container: jenkinsStarting jenkins-aws ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service: jenkins>
compose.parallel.feed_queue: Pending: set()
Attaching to jenkins-aws
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=jenkins-aws', 'com.docker.compose.oneoff=False']}, decode=True)
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Djenkins-aws%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <docker.types.daemon.CancellableStream object at 0x11125d6d8>
jenkins-aws | Sep 24, 2018 3:16:38 PM Main main
jenkins-aws | SEVERE: Running with Java class version 51.0, which is older than the required 52.0. See https://jenkins.io/redirect/java-support/
jenkins-aws | java.lang.UnsupportedClassVersionError: 51.0
jenkins-aws |   at Main.main(Main.java:146)
jenkins-aws | 
jenkins-aws | Jenkins requires Java 8, but you are running 1.7.0_181-b01 from /usr/lib/jvm/java-7-openjdk-amd64/jre
jenkins-aws | java.lang.UnsupportedClassVersionError: 51.0
jenkins-aws |   at Main.main(Main.java:146)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5')
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5')
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/wait HTTP/1.1" 200 30
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.21/containers/0ff9579902893c85c19bccbd58fc545ff8491171a29273ea7722e7be59a186e5/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 0}
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['--', '/usr/local/bin/jenkins.sh'],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': None,
            'Domainname': '',
            'Entrypoint': ['/bin/tini', '--', '/usr/local/bin/jenkins.sh'],
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
...jenkins-aws exited with code 0

我的Mac上装有最新的JDK8,但这可能是因为Docker映像上的JDK所致?我怎样才能解决这个问题?谢谢!

0 个答案:

没有答案