question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage with Docker

See original GitHub issue

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
...
COPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
...
#docker-compose.yml
...
  my-service:
    build:
      context: "."
      container_name: my_container
      command: ["/wait-for-it.sh", "mysql:3306", "--", [entrypoint function]]
...

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:41
  • Comments:16

github_iconTop GitHub Comments

18reactions
douglas-gibbonscommented, Nov 4, 2018

Thanks @agustisanchez - I like it. Depending on your setup, you might also copy wait-for-it.sh in as a mounted volume, such as this:

version: '3'

services:
  hello-world:
    image: ubuntu
    volumes:
      - ./wait-for-it.sh:/usr/local/bin/wait-for-it.sh
    command:
      - wait-for-it.sh
      - github.com:80
      - --
      - echo
      - "hello world"
8reactions
jakzalcommented, May 31, 2019

Multistage builds can be leveraged to install wait-for-it with apt-get:

FROM debian:buster-slim as wait-for-it
RUN apt-get update && apt-get install -y "wait-for-it"

FROM debian:buster-slim
COPY --from=wait-for-it /usr/bin/wait-for-it /usr/bin/wait-for-it

If there was an official docker image for wait-for-it (i.e. wait-for-it/wait-for-it) we could potentially do:

FROM debian:buster-slim
COPY --from=wait-for-it/wait-for-it /usr/bin/wait-for-it /usr/bin/wait-for-it
Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview | Docker Documentation
When running a container, it uses an isolated filesystem. This custom filesystem is provided by a container image. Since the image contains the...
Read more >
A Docker Tutorial for Beginners
The key benefit of Docker is that it allows users to package an application with all of its dependencies into a standardized unit...
Read more >
What is a Docker Image? Introduction and use cases
It is used to create, run and deploy applications that are isolated from the underlying hardware. A Docker container can use one machine,...
Read more >
How to Use a Dockerfile to Build a Docker Image - Linode
A Dockerfile is a text file of instructions which are used to automate installation and configuration of a Docker image.
Read more >
What is Docker Used For? A Docker Container Tutorial for ...
As you could see, most uses of Docker are to make life easier for devs when developing applications. But there are many other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found