Usage with Docker

Author: agustisanchezCreated Mar 5, 2018Updated Apr 14, 2022

In order to use it with Docker and docker-compose, place it alongside Dockerfile, build it into the image with exec permissions and reference it in docker-compose.yml.

- Dockerfile
- wait-for-it.sh
dockerfile
#Dockerfile
...
COPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
...
yaml
#docker-compose.yml
...
  my-service:
    build:
      context: "."
      container_name: my_container
      command: ["/wait-for-it.sh", "mysql:3306", "--", [entrypoint function]]
...