问题描述
因此,并不是所有人都对docker-compose有所了解,但是我正在尝试将CircleCI与我已经在本地使用Docker-Compose进行了Docker化的项目集成。但是当在CircleCI上运行相同的构建时,我似乎会遇到这些错误。
错误是:
Creating project_app_1 ... error
ERROR: for project_app_1 Cannot start service app: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./entrypoints/docker-entrypoint.sh\": stat ./entrypoints/docker-entrypoint.sh: no such file or directory"
ERROR: for app Cannot start service app: oci runtime error: container_linux.go:265: starting container process caused "exec: \"./entrypoints/docker-entrypoint.sh\": stat ./entrypoints/docker-entrypoint.sh: no such file or directory"
ERROR: Encountered errors while bringing up the project.
Exited with code exit status 1
CircleCI received exit code 1
作为参考,我的circleCI的 config.yml 文件是:
version: 2.1
orbs:
ruby: circleci/ruby@0.1.2
jobs:
build:
docker:
- image: circleci/cci-demo-docker-primary:0.0.2
steps:
- checkout
- setup_remote_docker
- run:
name: Install Docker Compose
command: |
set -x
curl -L https://github.com/docker/compose/releases/download/1.25.3/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
- run:
name: Set working directory
command: |
cd ./
chmod +x ./entrypoints/docker-entrypoint.sh
- run:
name: Running Compose to start container in test environment
command: |
docker-compose -f testenv.docker-compose.yml up -d
- run:
name: Setup test database and migrations
command: |
docker-compose exec app bundle exec rake db:setup db:migrate
- run:
name: Running tests
command: |
docker-compose exec rails test
我的 testenv.docker-compose.yml 文件如下:
version: '3.4'
services:
app:
build:
context: .
dockerfile: Dockerfile
depends_on:
- database
ports:
- "3000:3000"
volumes:
- .:/app
- gem_cache:/usr/local/bundle/gems
- node_modules:/app/node_modules
environment:
RAILS_ENV: test
DATABASE_NAME: proj_mgmt
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: database
database:
image: postgres:12.1
volumes:
- db_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
gem_cache:
db_data:
node_modules:
最后,我的 Dockerfile 是:
FROM ruby:2.7.0
ENV BUNDLER_VERSION=2.1.4
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt install -y nodejs
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install yarn
RUN gem install bundler:2.1.4
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config build.nokogiri --use-system-libraries
RUN bundle check || bundle install
COPY package.json yarn.lock ./
RUN yarn install --check-files
COPY . ./
RUN chmod +x ./entrypoints/docker-entrypoint.sh
ENTRYPOINT ["./entrypoints/docker-entrypoint.sh"]
在此错误的基本google搜索中,我被重定向到here,这表明我添加了
chmod +x docker-entrypoint.sh
到我的 Dockerfile 。
但这也无济于事,并且相同的错误仍然存在。相同的 testenv.docker-compose.yml 可以在我的本地计算机上完美运行,而且我似乎无法弄清楚出了什么问题。任何帮助表示赞赏。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)