英文:
The container created by docker-compose does not see the entrypoint
问题
I encountered a problem in docker-compose that the api
service doesn't see the entrypoint.sh
and crashes. Specific error:
> exec /app/entrypoint.sh: no such file or directory
Dockerfile
:
FROM ruby:3.1.0-slim
ENV LANG=C.UTF-8
WORKDIR app
RUN apt-get update && apt-get -y install build-essential libpq-dev autoconf autogen libtool
EXPOSE 3000
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY ./entrypoint.sh .
ENTRYPOINT ["/app/entrypoint.sh"]
.docker-compose.yml
:
services:
es:
image: elasticsearch:8.7.0
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms750m -Xmx750m
- xpack.security.enabled=false
db:
image: postgres:14.0-alpine
environment:
- POSTGRES_PASSWORD= ...
ports:
- 5431:5432
redis:
image: redis:7.0.11-alpine
api:
build: .
volumes:
- .:/app
ports:
- 3000:3000
environment:
- ELASTICSEARCH_URL=http://es:9200
- REDIS_URL=redis://redis:6379
command: bundle exec rails s -p 3000 -b '0.0.0.0'
depends_on:
- db
- redis
The file structure of the container created for the api
service:
Also, strangely enough, the dockerfile has not changed since it was successfully started. I can't figure out where the problem is. Help me, please
I tried deleting all images, all containers, and all volumes, none of this helped.
英文:
I encountered a problem in docker-compose that the api
service doesn't see the entrypoint.sh
and crashes. Specific error:
> exec /app/entrypoint.sh: no such file or directory
Dockerfile
:
FROM ruby:3.1.0-slim
ENV LANG=C.UTF-8
WORKDIR app
RUN apt-get update && apt-get -y install build-essential libpq-dev autoconf autogen libtool
EXPOSE 3000
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY ./entrypoint.sh .
ENTRYPOINT ["/app/entrypoint.sh"]
.docker-compose.yml
:
services:
es:
image: elasticsearch:8.7.0
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms750m -Xmx750m
- xpack.security.enabled=false
db:
image: postgres:14.0-alpine
environment:
- POSTGRES_PASSWORD= ...
ports:
- 5431:5432
redis:
image: redis:7.0.11-alpine
api:
build: .
volumes:
- .:/app
ports:
- 3000:3000
environment:
- ELASTICSEARCH_URL=http://es:9200
- REDIS_URL=redis://redis:6379
command: bundle exec rails s -p 3000 -b '0.0.0.0'
depends_on:
- db
- redis
The file structure of the container created for the api
service:
Also, strangely enough, the dockerfile has not changed since it was successfully started. I can't figure out where the problem is. Help me, please
I tried deleting all images, all containers and all volumes, none of this helped.
答案1
得分: 1
The executable in shebang of entrypoint.sh
is not found inside docker container. Install the executable or change shabang. Most probably you have bash and bash is not inside the container, for example.
英文:
The executable in shebang of entrypoint.sh
is not found inside docker container. Install the executable or change shabang. Most probably you have bash and bash is not inside the container, for exmaple.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论