What goes on behind the scenes in travis causing jobs that are essentially the same to behave so differently?

I have an ansible playbook I am trying to test in Travis. This is the travis.yml file:

#sudo: required

TRAVIS_SECURE_ENV_VARS: true

language: python

python: 2.7

services:
- docker

env:
  global:
    secure: "BI6cUmDsExjZdmw2+xrDfyTS2+x5xk1c9kvVOinY57upNcoOsolFT6XPEsBUH6e2GzFyHWQJ96yco7wUlGGFrTfxqpRN48uIjvsepr1XaWeYFczl7yOaAJWvCFPuX51Swdsbw6EN3Djw3V2oYvANM96t+FYHW+OK1wsiGu2A9yvLbFxidiqZFP0MIyRTwxB8mnCm1ZUT1Cnu23fIVkUlzXkTpC06EymxWbdAWAFkmyjzoV0q5oosMrEJXelnC6ezOIV4PwrB5vHfe9q0CcssTGi6d3onDXeBL8x1I/ZYDp+J7xk/tfhDBNdcn3J2i2VJtcIuagbzv9NN/3x4yLNPEZ1N8so/yueVpsJdgqng+ef5opifm0btLfdaX5ZaammBnfrd8mSS+witzKqLllQges3Do1pcozPB534rxEQLYzvVjmoVtrdSM2xUP80biTpQ81q5Vt9/HROI2QPA1F/e2zIudKXxQSWrEsU89bSFTgYDzmkStEGcfom7GvyYEfbTaEZE6Hh2ofHo2EAEuNStAVazasozPDSrWBzT1g7T8no3UCv0bQQdrJ1ZGQ37MsaGoX/NfZS5qMhlNoZnNcAUrFz/A81OykUjJcnCxG8SSHgG6jNFFw1M+UyqjqI1Mv3abCdT8CbfcZvYDdNKPPobLxf+75KUr235/NlXetgiWnw="

before_install:
- openssl aes-256-cbc -K $encrypted_4e087206a019_key -iv $encrypted_4e087206a019_iv -in id_travis.enc -out id_travis -d
- openssl aes-256-cbc -K $encrypted_4e087206a019_key -iv $encrypted_4e087206a019_iv -in id_travis.enc -out id_travis -d
- sudo apt-get update
- sudo apt-get remove docker-engine -yq
- sudo apt-get install docker-engine="1.9.1-0~trusty" -yq --no-install-suggests --no-install-recommends --force-yes -o Dpkg::Options::="--force-confnew"
- docker pull censofdockers/centos6-miniconda
- docker pull censofdockers/ubuntu-miniconda
- CID=$(docker run --privileged --detach --volume="${PWD}":/root/django_deployment:rw -p 80 --name test_centos censofdockers/centos6-miniconda sleep 550) 
- CID2=$(docker run --privileged --detach --volume="${PWD}":/root/django_deployment:rw -p 80 --name test_ubuntu censofdockers/ubuntu-miniconda sleep 550)
- DOCKER_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}`
- DOCKER_IP2=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID2}`

install:
- docker exec -it test_centos /bin/bash -c "chmod +x /root/django_deployment/installcentos.sh"
- docker exec -it test_centos /bin/bash -c "./root/django_deployment/installcentos.sh"
- docker exec -it test_ubuntu /bin/bash -c "chmod +x /root/django_deployment/installubuntu.sh"
- docker exec -it test_ubuntu /bin/bash -c "./root/django_deployment/installubuntu.sh"
- sudo apt-get install -y curl
- pip install selenium nose

script:

- docker ps

#- docker exec -it test_centos /bin/bash -c "git clone $DEPLOYMENT_URL"
#- docker exec -it test_centos /bin/bash -c "ls -al ~/.ssh/*"
#- docker exec -it test_ubuntu /bin/bash -c "rm /root/.ssh/authorized_keys"
#- docker exec -it test_ubuntu /bin/bash -c "ls -al ~/.ssh/*"
#- docker exec -it test_ubuntu /bin/bash -c "echo $DEPLOYMENT_URL"
#- docker exec -it test_ubuntu /bin/bash -c "git clone $DEPLOYMENT_URL"
- docker exec -it test_centos /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts /root/django_deployment/django_app_server_db_server/deployment/main.yml" 
# && docker exec -it test_ubuntu /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts -v /root/django_deployment/django_app_server_db_server/deployment/main.yml"
- docker exec -it test_centos /bin/bash -c "/etc/rc.d/init.d/uwsgi stop && sleep 3 && /etc/rc.d/init.d/uwsgi start && source ~/.bash_profile && rspec /root/django_deployment/tests/spec/test_ansible_spec.rb" && DOCKER_IP=$DOCKER_IP nosetests -sv tests/python/verify_image.py
  # - echo $TRAVIS_JOB_ID
- echo $DOCKER_IP
- DOCKER_IP=${DOCKER_IP} nosetests -sv tests/python/verify_image.py
#start ubuntu test
- docker exec -it test_ubuntu /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts /root/django_deployment/django_app_server_db_server/deployment/main.yml"

#- docker exec -it test_ubuntu /bin/bash -c "/etc/init.d/uwsgi stop && sleep 3 && /etc/init.d/uwsgi start && source ~/.bash_profile && rspec /root/django_deployment/tests/spec/test_ansible_spec.rb" && DOCKER_IP=$DOCKER_IP2 nosetests -sv tests/python/verify_image.py
- echo $DOCKER_IP2
- DOCKER_IP=${DOCKER_IP2} nosetests -sv tests/python/verify_image.py

#for test purpose only
#- docker exec -it test_centos /bin/bash -c "/opt/miniconda2/bin/ansible --version"
#- docker exec -it test_centos /bin/bash -c "which ansible"
#- docker exec -it test_ubuntu /bin/bash -c "ansible --version"
#- docker exec -it test_ubuntu /bin/bash -c "which ansible"

I am trying incorporate docker-compose into it with the following:

  • Apache Tomcat 8 not starting within a docker container
  • configuring docker in mac
  • Can't access docker containers when there more than 2 containers
  • Git to docker export
  • How do a see the “ancestor tree” of a docker-compose file
  • Docker can not resolve names when building images
  • #sudo: required
    
    TRAVIS_SECURE_ENV_VARS: true
    
    language: python
    
    python: 2.7
    
    services:
    - docker
    
    env:
      global:
        secure: "BI6cUmDsExjZdmw2+xrDfyTS2+x5xk1c9kvVOinY57upNcoOsolFT6XPEsBUH6e2GzFyHWQJ96yco7wUlGGFrTfxqpRN48uIjvsepr1XaWeYFczl7yOaAJWvCFPuX51Swdsbw6EN3Djw3V2oYvANM96t+FYHW+OK1wsiGu2A9yvLbFxidiqZFP0MIyRTwxB8mnCm1ZUT1Cnu23fIVkUlzXkTpC06EymxWbdAWAFkmyjzoV0q5oosMrEJXelnC6ezOIV4PwrB5vHfe9q0CcssTGi6d3onDXeBL8x1I/ZYDp+J7xk/tfhDBNdcn3J2i2VJtcIuagbzv9NN/3x4yLNPEZ1N8so/yueVpsJdgqng+ef5opifm0btLfdaX5ZaammBnfrd8mSS+witzKqLllQges3Do1pcozPB534rxEQLYzvVjmoVtrdSM2xUP80biTpQ81q5Vt9/HROI2QPA1F/e2zIudKXxQSWrEsU89bSFTgYDzmkStEGcfom7GvyYEfbTaEZE6Hh2ofHo2EAEuNStAVazasozPDSrWBzT1g7T8no3UCv0bQQdrJ1ZGQ37MsaGoX/NfZS5qMhlNoZnNcAUrFz/A81OykUjJcnCxG8SSHgG6jNFFw1M+UyqjqI1Mv3abCdT8CbfcZvYDdNKPPobLxf+75KUr235/NlXetgiWnw="
    
    before_install:
    - openssl aes-256-cbc -K $encrypted_4e087206a019_key -iv $encrypted_4e087206a019_iv -in id_travis.enc -out id_travis -d
    - openssl aes-256-cbc -K $encrypted_4e087206a019_key -iv $encrypted_4e087206a019_iv -in id_travis.enc -out id_travis -d
    - sudo apt-get update
    - sudo apt-get remove docker-engine -yq
    - sudo apt-get install docker-engine="1.9.1-0~trusty" -yq --no-install-suggests --no-install-recommends --force-yes -o Dpkg::Options::="--force-confnew"
    # reinstall docker-compose at specific version
    - sudo rm -f /usr/local/bin/docker-compose
    - curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > docker-compose
    - chmod +x docker-compose
    - sudo mv docker-compose /usr/local/bin
    
    # - docker pull censofdockers/centos6-miniconda
    # - docker pull censofdockers/ubuntu-miniconda
    # - CID=$(docker run --privileged --detach --volume="${PWD}":/root/django_deployment:rw -p 80 --name test_centos censofdockers/centos6-miniconda sleep 550) 
    # - CID2=$(docker run --privileged --detach --volume="${PWD}":/root/django_deployment:rw -p 80 --name test_ubuntu censofdockers/ubuntu-miniconda sleep 550)
    # - DOCKER_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}`
    # - DOCKER_IP2=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID2}`
    
    # before_script:
    
    # # - docker-compose up -d -f tests/docker-compose.yml
    
    # - docker-compose -f tests/docker-compose.yml up -d 
    # - DOCKER_IP= `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -aqf "name=test_centos")`
    # - DOCKER_IP= `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -aqf "name=test_ubuntu")`
    
    install:
    - docker-compose -f tests/docker-compose.yml up -d 
    - cd tests && docker-compose ps && cd ..
    # - docker ps
    # - docker exec -it test_centos /bin/bash -c "ls -al /root/django_deployment/"
    - docker exec -it test_centos /bin/bash -c "chmod +x /root/django_deployment/installcentos.sh"
    - docker exec -it test_centos /bin/bash -c "./root/django_deployment/installcentos.sh"
    - docker exec -it test_ubuntu /bin/bash -c "chmod +x /root/django_deployment/installubuntu.sh"
    - docker exec -it test_ubuntu /bin/bash -c "./root/django_deployment/installubuntu.sh"
    # - DOCKER_IP= `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -aqf "name=test_centos")`
    # - DOCKER_IP= `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -aqf "name=test_ubuntu")`
    - DOCKER_IP=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' test_centos`
    - DOCKER_IP2=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' test_ubuntu`
    - pip install selenium nose
    
    script:
    
    # Start redhat or centos test
    - docker exec -it test_centos /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts /root/django_deployment/django_app_server_db_server/deployment/main.yml" 
    # && docker exec -it test_ubuntu /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts -v /root/django_deployment/django_app_server_db_server/deployment/main.yml"
    - docker exec -it test_centos /bin/bash -c "/etc/rc.d/init.d/uwsgi stop && sleep 3 && /etc/rc.d/init.d/uwsgi start && source ~/.bash_profile && rspec /root/django_deployment/tests/spec/test_ansible_spec.rb" && DOCKER_IP=$DOCKER_IP nosetests -sv tests/python/verify_image.py
    - echo $DOCKER_IP
    - DOCKER_IP=${DOCKER_IP} nosetests -sv tests/python/verify_image.py
    # - echo $TRAVIS_JOB_ID
    
    #start ubuntu test
    - docker exec -it test_ubuntu /bin/bash -c "export ECLAIM_BRANCH=${SHIPPABLE_ECLAIM_BRANCH:-staging} && export DEPLOYMENT_URL=$DEPLOYMENT_URL && /opt/miniconda2/bin/ansible-playbook -e 'django_app_home=/opt/eclaim_revamp/eclaim app_version=eclaim_revamp' -e 'db_server_ip=localhost' -i /root/django_deployment/django_app_server_db_server/deployment/tests/hosts /root/django_deployment/django_app_server_db_server/deployment/main.yml"
    
    - docker exec -it test_ubuntu /bin/bash -c "/etc/init.d/uwsgi stop && sleep 3 && /etc/init.d/uwsgi start && source ~/.bash_profile && rspec /root/django_deployment/tests/spec/test_ansible_spec.rb" && DOCKER_IP=$DOCKER_IP2 nosetests -sv tests/python/verify_image.py
    - echo $DOCKER_IP2
    - DOCKER_IP=${DOCKER_IP2} nosetests -sv tests/python/verify_image.py
    
    after_script:
      - cd tests && docker-compose stop
    

    What I don’t understand is, the first script passes while the second one fails (build time exceeded). The two of them are identical except that one uses manual docker run while the other one uses docker-compose to call up the two containers. What goes in the Travis backend to cause such different outcomes using similar scripts ?

    Below is docker-compose.yml:

    app_server:
        image: censofdockers/centos6-miniconda
        container_name: test_centos
        privileged: true
        volumes:
            - ..:/root/django_deployment
        command:
            - /sbin/init
        expose:
            - 80
        # ports:
        #     - "80:80"
    db_server:
        image: censofdockers/ubuntu-miniconda
        container_name: test_ubuntu
        privileged: true
        volumes:
            - ..:/root/django_deployment
        command:
            - /sbin/init
        expose:
            - 80
        # ports:
        #     - "80:80"
    

  • Docker image running as unknown user ID can delete root files
  • How to integrate Capistrano with Docker for deployment?
  • ADDing from the command line interface to a newly created container
  • Install MySQL connector/J in Docker container
  • Environment variables passed to docker run
  • npm install error with kurento - docker
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.