首页 > 解决方案 > 如何使用 docker-compose 解决 Jenkins 错误

问题描述

我试图用 docker-compose 运行 jenkins

version: '3.5'
services:
  jenkins:
    build:
      context: .
      dockerfile: ./jenkins.Dockerfile
    volumes:
    - $PWD/jenkins_home:/var/jenkins_home
    - $PWD:/app
    ports:
      - 8080:8080  

但最终在尝试访问某些卷时出现此访问被拒绝错误。我无法在浏览器中打开 Localhost。

WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use `docker stack deploy`.

Starting 8fd02292a7fe_ejercicio_jenkins_1 ... 
Starting 8fd02292a7fe_ejercicio_jenkins_1 ... done
Attaching to 8fd02292a7fe_ejercicio_jenkins_1
8fd02292a7fe_ejercicio_jenkins_1 | Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
8fd02292a7fe_ejercicio_jenkins_1 | touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
8fd02292a7fe_ejercicio_jenkins_1 exited with code 1

我该如何解决这个问题?

标签: jenkinsdocker-composecontinuous-integrationdevopscontinuous-deployment

解决方案


chmod 777 -R $PWD/jenkins_home

推荐阅读