如何在Travis CI中使用Devicemapper Docker文件系统后端?

时间:2015-09-30 07:46:10

标签: travis-ci

由于https://github.com/docker/docker/issues/6980,我在Travis CI方面遇到了一些问题。

我找到了解决方案 - 在/ etc / default / docker中添加:

DOCKER_OPTS="--storage-driver=devicemapper"

所以我尝试修改Docker设置以使用.travis.yml中的另一个存储驱动程序:

before_install:
  - sudo ps -A|grep docker
  - sudo service docker stop
  - sudo ps -A
  - sudo echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
  #- sudo echo 'DOCKER_OPTS="-s devicemapper"' | sudo tee /etc/default/docker > /dev/null
  - sudo cat /etc/default/docker
  - sudo service docker start
  - sudo ps -A|grep docker
  #- sudo service docker restart
  - sudo docker pull centos:7

但它失败了。 当我使用时:

- sudo echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null

我收到错误https://travis-ci.org/weldpua2008/ansible-apache/jobs/82684013

Post http:///var/run/docker.sock/v1.19/images/create?fromImage=weldpua2008%2Fdocker-ansible%3Acentos6_v1.9.2: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?

当我尝试时:

 - sudo echo 'DOCKER_OPTS="-s devicemapper"' | sudo tee /etc/default/docker > /dev/null

我发现https://travis-ci.org/weldpua2008/ansible-apache/jobs/82685316错误:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

1 个答案:

答案 0 :(得分:1)

由于Travis CI Docker的错误,有办法使用新版本的Docker。感谢Travis CI团队的Dominic Jodoin。 .travis.yml:

sudo: required
env:
  #matrix:
  - OS_TYPE=centos OS_VERSION=6 ANSIBLE_VERSION=1.9.2

branches:
  only:
  - master
#  - stable

services:
  - docker

before_install:
  - sudo apt-get update
  - sudo apt-get upgrade lxc-docker
  - echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
  - sudo service docker restart
  - sleep 5
  - sudo docker pull weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION}

script:
 # Run tests in Container
 - sudo docker run --rm=true -v `pwd`:/ansible-apache:rw weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION} /bin/bash -c "/ansible-apache/tests/test-in-docker-image.sh ${OS_TYPE} ${OS_VERSION} ${ANSIBLE_VERSION}"

notifications:
  email: false