docker-compose-wait icon indicating copy to clipboard operation
docker-compose-wait copied to clipboard

Can you provide a lightweight docker image?

Open Its-Alex opened this issue 3 years ago • 14 comments

Hi,

I would like to know if you can provide an auto updated docker image on dockerhub for example that can be directly used on any system running docker?

For example, I often use https://hub.docker.com/r/waisbrot/wait to wait for other containers directly on shell scripts.

What do you think about it?

Best regards, Alexandre.

Its-Alex avatar Mar 21 '21 13:03 Its-Alex

Hi @Its-Alex, indeed I could, but honestly, as the primary use case for this tool is to be easily importable while building your custom image, I am not sure what base image I should use for it.

ufoscout avatar Mar 31 '21 11:03 ufoscout

@Its-Alex I believe it would be even ligther if simply copy or download the built binary to the final image

Example:

FROM any-distro

COPY mystuff in-my-image

RUN my-crazy-commands

RUN install-curl && / 
    curl docker-compose-wait-binary &&  /
    chmod +x docker-compose-wait-binary && /
    uninstall curl
...

Since you're using the same architecture (x86_64, ARM) during the build I think you wont have problems

Can you try this on your projects and give some feedback?

edumco avatar May 08 '21 04:05 edumco

@edumco how is this linked to #50?

ufoscout avatar May 08 '21 08:05 ufoscout

Oh sorry. I confused the issues

edumco avatar May 08 '21 16:05 edumco

@ufoscout The lightweight image has possible, like alpine or even scratch if possible. My aim is to use this image with configurations where I can't modify docker container and I want to have as little as possible dependencies.

For example when using https://docs.docker.com/compose/extends/ I can use an image that wait for another container in shell scripts. At initialization this is very useful to manually launch a database migration.

Its-Alex avatar May 10 '21 20:05 Its-Alex

@ufoscout The lightweight image has possible, like alpine or even scratch if possible. My aim is to use this image with configurations where I can't modify docker container and I want to have as little as possible dependencies.

For example when using https://docs.docker.com/compose/extends/ I can use an image that wait for another container in shell scripts. At initialization this is very useful to manually launch a database migration.

You want to create a small image so instead you modify your containers you create a container that waits to call another container?

Can you detail this data base example?

edumco avatar May 15 '21 02:05 edumco

FROM alpine AS wait
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait

# using
COPY --from=wait /wait ./wait

minho-comcom-ai avatar Jul 18 '21 08:07 minho-comcom-ai

@Its-Alex The solution provided by @minho-comcom-ai solved your needs?

edumco avatar Aug 12 '21 17:08 edumco

@ufoscout I believe this might be solved by updating the documentation with more examples. What do you think?

edumco avatar Aug 12 '21 17:08 edumco

@Its-Alex The solution provided by @minho-comcom-ai solved your needs?

Yes but this would be awesome if the docker image can be maintained directly by a CI in this repo. What I ask in this issue.

This will be a lot easy to use, and update. And allow all community to directly use updated docker image.

Its-Alex avatar Aug 12 '21 18:08 Its-Alex

@Its-Alex Have you ever tryed to create a Pull Request?

I could review and create the pipeline, what do you think?

edumco avatar Aug 12 '21 18:08 edumco

@ufoscout @edumco I made a PR with an example of what I would like to see with this issue. Can you check it and tell me what I need to improve?

PS: Sorry for my late answer :pray:

Its-Alex avatar Oct 18 '21 20:10 Its-Alex

@Its-Alex thanks, I'll have a look at it. Anyway, this issue is not for a dockerfile example but to have an official image pushed in dockerhub

ufoscout avatar Jan 24 '22 14:01 ufoscout

@ufoscout Up ?

Its-Alex avatar Jun 19 '22 15:06 Its-Alex

@ufoscout Have you take time to look at the PR?

Its-Alex avatar Mar 18 '23 08:03 Its-Alex

@Its-Alex I did, but the PR did not solve this issue

ufoscout avatar Mar 21 '23 17:03 ufoscout

@ufoscout My PR is dated from 2021 at this time there was no Dockerfile (added on July 2022 in https://github.com/ufoscout/docker-compose-wait/commit/36501adb3917d13cab37b38144cd61bdfe11a041). Moreover, this is a test Dockerfile.

In this issue I speak about a lightweight docker image built by Github action, hosted on a free repository that can be downloaded by anyone at anytime without need to host their own image.

By curiosity, can you tell me the reason for refusing my PR? docker-compose.yml was for test purpose :confused:

Its-Alex avatar Mar 21 '23 17:03 Its-Alex

By curiosity, can you tell me the reason for refusing my PR? docker-compose.yml was for test purpose

It was redundant as there is already a docker-compose example

ufoscout avatar Apr 07 '23 13:04 ufoscout

How about multi-platform images (built on top of scratch) that contain only the wait file? With this approach, we can use just one line of COPY --from... command, and it will automatically adapt to the target platform. For example, when building an image on an aarch64 machine, the aarch64 variant of wait would be gotten along with the file permission information.

Here's the usage to reflect this change:

- ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.11.0/wait /wait
- RUN chmod +x /wait
+ COPY --from=ghcr.io/ufoscout/docker-compose-wait:2.11.0 /wait /wait

I have also suggested a PR (https://github.com/ufoscout/docker-compose-wait/pull/75) for this.

zhangt2333 avatar Apr 18 '23 15:04 zhangt2333

Fixed by #75

ufoscout avatar Apr 27 '23 16:04 ufoscout