由于docker中.sh文件的权限被拒绝,travis测试失败

时间:2018-11-11 21:02:53

标签: bash docker flask travis-ci

我正在尝试让travis与我的容器烧瓶应用程序一起使用。在本地构建和提交时一切正常,我在此命令上失败:

docker-compose -f docker-compose-dev.yml up --build -d

这是travis的错误:

Successfully built e5cc5b91a3ee
Successfully tagged testdriven-app_nginx:latest
Creating testdriven-app_users-db_1 ... 
ERROR: for testdriven-app_users_1  Cannot start service users: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied"
ERROR: for users  Cannot start service users: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/usr/src/app/entrypoint.sh\": permission denied"
ERROR: Encountered errors while bringing up the project.
The command "sudo docker-compose -f docker-compose-dev.yml up --build -d" failed and exited with 1 during .

这是我的travis yml文件,我在之前的脚本部分中失败了:

sudo: required

services:
  - docker

env:
  DOCKER_COMPOSE_VERSION: 1.21.1

before_install:
  - sudo rm /usr/local/bin/docker-compose
  - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
  - chmod +x docker-compose
  - sudo mv docker-compose /usr/local/bin

before_script:
  - docker-compose -f docker-compose-dev.yml up --build -d

script:
  - docker-compose -f docker-compose-dev.yml run users python manage.py test
  - docker-compose -f docker-compose-dev.yml run users python flake8 project

after_script:
  - docker-compose -f docker-compose-dev.yml down

我在docker compose上给了自己chmod,据我了解,这应该给了我对该文件的权限。

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

我从

更改了dockerprofile
CMD["/usr/src/app/entrypoint.sh"]

RUN ["chmod","+x","/usr/src/app/entrypoint.sh"]

解决了问题