Ali cloud server installation Jenkins

1. pull jenkins image from the warehouse

docker pull jenkins/jenkins:lts-alpine

2.新建docker-compose.yml

touch docker-compose.yml
vim docker-compose.yml
#docker-compose.yml的内容如下:
version: '3'

services:
  jenkins:
    restart: always
    image: jenkins/jenkins:lts-alpine
    ports:
      - "8081:8080"
      - "14005:50000"
    volumes:
      - "/var/jenkins_homt"
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
      placement:
        constraints: [node.hostname == worker]

3.编排 docker-compose.yml

docker-compose up -d

4. Start the query log:

docker logs --tail="200" 5dcc829c4222
其中最后的一串字符串为容器 id,从日志中还可以获取到Jenkins 的初始化密码,并且在容器对应的目录下可以看到对应的密码的地址

Here Insert Picture Description
While the above are not the problem, but Ali cloud there is a security policy, in the above configuration of the host port 8081 to port 8080 mapping container, so you need to port 8081 to open security group

  ports:
      - "8081:8080"
      - "14005:50000"

Specific operation is as follows:
Here Insert Picture Description
select a configuration rule
Here Insert Picture Description

Add port range and set the authorization object: 0.0.0.0/0
Here Insert Picture Description
saved, browser access to the corresponding port of ip
Here Insert Picture Description

Published 24 original articles · won praise 6 · views 20000 +

Guess you like

Origin blog.csdn.net/li_yan_sring/article/details/86252822