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/

相关推荐
Crazy________1 小时前
k8s部署若依微服务架构流程,v3.6.6
运维·云原生·容器·kubernetes·状态模式
初级炼丹师(爱说实话版)2 小时前
Ubuntu服务器配置docker
服务器·ubuntu·docker
生活爱好者!3 小时前
NAS还能用来开视频会议?docker一键部署MiroTalk SFU
运维·docker·容器
xiaoxiangsiyan4 小时前
GitLab CI/CD 自托管(EE 企业版)+ Kubernetes Runner 集群 + ArgoCD(GitOps 部署)
运维·网络·ci/cd·容器·kubernetes·gitlab·argocd
PC2005-cloud4 小时前
KubeSphere 安装到插件管理实战:本地 K8s 搭建可视化容器平台
云原生·容器·kubernetes
heimeiyingwang4 小时前
【CI/CD·Jenkins篇】环境搭建:从零部署 Jenkins 主从架构
ci/cd·jenkins
兵bing5 小时前
Docker Compose 进阶配置与最佳实践笔记
docker
是良辰5 小时前
Docker Nginx HTTPS 自签证书部署完整操作文档
nginx·docker·https
heimeiyingwang6 小时前
【CI/CD·Jenkins篇】Pipeline 基础:Declarative 与 Scripted 语法详解
ci/cd·pipeline·jenkins
瞬间&永恒~6 小时前
【Docker】(四)Namespace 详解
运维·docker·容器