docker-compose安装配置jenkins

archery

安装docker-compose

复制代码
curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose


chmod 755 /usr/local/bin/docker-compose



docker-compose version

安装docker

复制代码
 yum install epel-release  yum-utils

yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
 
yum install docker-ce -y

systemctl enable docker --now
 
systemctl start docker


systemctl status docker

编写 docker-compose.yaml文件

复制代码
version: '3'
services:                                      # 集合
  docker_jenkins:
    user: root                                 # 为了避免一些权限问题 在这我使用了root
    restart: always                            # 重启方式
    image: jenkins/jenkins:lts                 # 指定服务所使用的镜像 在这里我选择了 LTS (长期支持)
    container_name: jenkins                    # 容器名称
    ports:                                     # 对外暴露的端口定义
      - 8082:8080                              # 访问Jenkins服务端口
      - 50000:50000
    volumes:                                   # 卷挂载路径
      - /var/vol_dockers/jenkins_home/:/var/jenkins_home  # 这是我们一开始创建的目录挂载到容器内的jenkins_home目录
      - /var/run/docker.sock:/var/run/docker.sock
      - /usr/bin/docker:/usr/bin/docker                # 这是为了我们可以在容器内使用docker命令
      - /usr/local/bin/docker-compose:/usr/local/bin/docker-compose

启动 执行结果如下

复制代码
[root@localhost docker_compose_jenkins]# docker-compose up -d
Creating network "docker_compose_jenkins_default" with the default driver
Pulling docker_jenkins (jenkins/jenkins:lts)...
lts: Pulling from jenkins/jenkins
1b13d4e1a46e: Pull complete
5303cfd924b5: Pull complete
902fe2af3265: Pull complete
866f59365203: Pull complete
da9419a1cff4: Pull complete
0f760cf88b2d: Pull complete
e1f034047864: Pull complete
b7fd15023031: Pull complete
be03ab118c25: Pull complete
13230d8adc6e: Pull complete
52b66e48bb82: Pull complete
7a718fc8b5a4: Pull complete
Digest: sha256:a786794ea0a2429e65d67a88fe497cbd97a0d73d73a39f2fd0eae3b380eb70ff
Status: Downloaded newer image for jenkins/jenkins:lts
Creating jenkins ... done

查看登录密码

复制代码
docker ps -a 
查看容器ID


docker logs a52debe35ff1      #容器id获取密码



Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

54e6428716b742d8ad6a76542f7e9bfb

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

访问: http://jenkinsIP :8082/

相关推荐
chinesegf26 分钟前
Docker篇4-本地项目app.py与docker加载项目镜像的开发顺序
运维·docker·容器
CyreneSimon27 分钟前
Docker 拉取配置教程:解决镜像拉取连接超时问题
运维·docker·容器
xx.ii3 小时前
k8s的资源管理
云原生·容器·kubernetes
人间打气筒(Ada)4 小时前
Kubeadm快速部署k8s集群----1.20.0版本(基于centos7.9,因为k8s版本为1.24之下,所以可以直接使用docker)
docker·容器·kubernetes
维尔切4 小时前
k8s 实战入门
云原生·容器·kubernetes
xx.ii4 小时前
K8s练习
云原生·容器·kubernetes
算是难了4 小时前
K8s基础总结
云原生·容器·kubernetes
失因4 小时前
Kubernetes(K8s)资源管理
云原生·容器·kubernetes
xuhe26 小时前
🛠️ 深度解析我的 Overleaf 私有化部署:一份稳定、高兼容性的 `docker-compose.yaml`
linux·docker·科研·overleaf
白小云<7 小时前
docker镜像
docker·容器·eureka