在docker-compose中使用bash失败

时间:2019-10-04 22:36:52

标签: docker-compose

我正在尝试使用bash构建和运行一个容器。是否可以在同一命令中安装和使用bash?我收到此错误:

$ docker-compose -f docker-compose-infra.yml up --build load-dynamodb
Creating load-dynamodb ... error

ERROR: for load-dynamodb  Cannot start service load-dynamodb: OCI 
runtime create failed: container_linux.go:345: starting container 
process caused "exec: \"bash\": executable file not found in $PATH": 
unknown

“命令”将安装一些依赖项,包括bash,然后尝试使用bash运行脚本:

load-dynamodb:
  container_name: "load-dynamodb"
  image: alpine:3.6
  command: >
    apk -v --update add \
           python \
           py-pip \
           groff \
           less \
           mailcap \
           && \
       pip install --upgrade awscli==1.14.5 s3cmd==2.0.1 python-magic && \
       apk -v --purge del py-pip && \
       rm /var/cache/apk/* && \
       apk -v --update add bash && \
       /usr/local/bin/provision-dynamo-db.sh
 volumes:
   - /root/.aws
   - /project
   - ./_scripts/provision-dynamo-db.sh:/usr/local/bin/provision-dynamo-db.sh
   - ./configuration:/etc/conf
 working_dir: /project
 entrypoint: ["bash"]
 environment:
   - AWS_DEFAULT_REGION=us-west-1
   - AWS_SECRET_ACCESS_KEY=foo
   - AWS_ACCESS_KEY_ID=foo

如果不在“命令”中,有没有办法做到这一点?

0 个答案:

没有答案