entrypoint: "entrypoint.sh" - docker compose

overexchange picture overexchange · Oct 17, 2019 · Viewed 21.3k times · Source

There is no such file by name entrypoint.sh in my workspace.

But below instruction in docker-compose.yml is referring it:

builder: 
  build: ../../
  dockerfile: docker/dev/Dockerfile
  volumes:
    - ../../target:/wheelhouse
  volumes_from:
    - cache
  entrypoint: "entrypoint.sh"
  command: ["pip", "wheel", "--non-index", "-f /build", "."]

where ../docker/dev/Dockerfile has

# Set defaults for entrypoint and command string
ENTRYPOINT ["test.sh"]
CMD ["python", "manage.py", "test", "--noinput"]

What does entrypoint: "entrypoint.sh" actually do?

Answer

rok picture rok · Oct 17, 2019

entrypoint: "entrypoint.sh" overrides ENTRYPOINT ["test.sh"] from Dockerfile.

From the docs:

Setting entrypoint both overrides any default entrypoint set on the service’s image with the ENTRYPOINT Dockerfile instruction, and clears out any default command on the image - meaning that if there’s a CMD instruction in the Dockerfile, it is ignored.

  • ENTRYPOINT ["test.sh"] is set in Dockerfile describing docker image

  • entrypoint: "entrypoint.sh" is set in docker-compose file which describes multicontainer environment while referencing the Dockerfile.

  • docker-compose build builder will build image and set entrypoint to ENTRYPOINT ["test.sh"] set in Dockerfile.

  • docker-compose up builder will start container with entrypoint entrypoint.sh pip wheel --no-index '-f /build' . set in docker-compose file