Docker-compose创建的容器无法看到入口点。

huangapple go评论84阅读模式
英文:

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:

  1. FROM ruby:3.1.0-slim
  2. ENV LANG=C.UTF-8
  3. WORKDIR app
  4. RUN apt-get update && apt-get -y install build-essential libpq-dev autoconf autogen libtool
  5. EXPOSE 3000
  6. COPY Gemfile /app/Gemfile
  7. COPY Gemfile.lock /app/Gemfile.lock
  8. RUN bundle install
  9. COPY ./entrypoint.sh .
  10. ENTRYPOINT ["/app/entrypoint.sh"]

.docker-compose.yml:

  1. services:
  2. es:
  3. image: elasticsearch:8.7.0
  4. environment:
  5. - discovery.type=single-node
  6. - ES_JAVA_OPTS=-Xms750m -Xmx750m
  7. - xpack.security.enabled=false
  8. db:
  9. image: postgres:14.0-alpine
  10. environment:
  11. - POSTGRES_PASSWORD= ...
  12. ports:
  13. - 5431:5432
  14. redis:
  15. image: redis:7.0.11-alpine
  16. api:
  17. build: .
  18. volumes:
  19. - .:/app
  20. ports:
  21. - 3000:3000
  22. environment:
  23. - ELASTICSEARCH_URL=http://es:9200
  24. - REDIS_URL=redis://redis:6379
  25. command: bundle exec rails s -p 3000 -b '0.0.0.0'
  26. depends_on:
  27. - db
  28. - redis

The file structure of the container created for the api service:
Docker-compose创建的容器无法看到入口点。

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 Docker-compose创建的容器无法看到入口点。

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:

  1. FROM ruby:3.1.0-slim
  2. ENV LANG=C.UTF-8
  3. WORKDIR app
  4. RUN apt-get update && apt-get -y install build-essential libpq-dev autoconf autogen libtool
  5. EXPOSE 3000
  6. COPY Gemfile /app/Gemfile
  7. COPY Gemfile.lock /app/Gemfile.lock
  8. RUN bundle install
  9. COPY ./entrypoint.sh .
  10. ENTRYPOINT ["/app/entrypoint.sh"]

.docker-compose.yml:

  1. services:
  2. es:
  3. image: elasticsearch:8.7.0
  4. environment:
  5. - discovery.type=single-node
  6. - ES_JAVA_OPTS=-Xms750m -Xmx750m
  7. - xpack.security.enabled=false
  8. db:
  9. image: postgres:14.0-alpine
  10. environment:
  11. - POSTGRES_PASSWORD= ...
  12. ports:
  13. - 5431:5432
  14. redis:
  15. image: redis:7.0.11-alpine
  16. api:
  17. build: .
  18. volumes:
  19. - .:/app
  20. ports:
  21. - 3000:3000
  22. environment:
  23. - ELASTICSEARCH_URL=http://es:9200
  24. - REDIS_URL=redis://redis:6379
  25. command: bundle exec rails s -p 3000 -b '0.0.0.0'
  26. depends_on:
  27. - db
  28. - redis

The file structure of the container created for the api service:
Docker-compose创建的容器无法看到入口点。

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 Docker-compose创建的容器无法看到入口点。

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.

huangapple
  • 本文由 发表于 2023年5月13日 16:58:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76241895.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定