Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call a local Docker image? #595

Closed
Forum1877621 opened this issue Jun 27, 2024 · 4 comments · Fixed by #609
Closed

How to call a local Docker image? #595

Forum1877621 opened this issue Jun 27, 2024 · 4 comments · Fixed by #609
Labels
help wanted Extra attention is needed needs-investigation More detailed look is needed

Comments

@Forum1877621
Copy link

I got this example working: https://dagu.readthedocs.io/en/latest/yaml_format.html#use-host-s-docker-environment

But when I try to call a local Docker image, it tries to pull from Docker Hub and gives an error

Any ideas on how to fix this?

@yohamta yohamta added help wanted Extra attention is needed needs-investigation More detailed look is needed labels Jun 28, 2024
@soujhony
Copy link

soujhony commented Jul 2, 2024

+1
when i run:
docker run -v /var/run/docker.sock:/var/run/docker.sock -p 2376:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock

this is the result:
Unable to find image 'bobrik/socat:latest' locally
latest: Pulling from bobrik/socat
docker: [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/bobrik/socat:latest to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/.

docker --version

Docker version 26.1.4, build 5650f9b

@x4204
Copy link
Contributor

x4204 commented Jul 13, 2024

I encountered the same issue when using the docker executor to run a container with a locally built image. The way I get around that is by running a local docker registry instance.

For example, let's say I have an image I want to use that I built on my machine with this command:

docker build --tag custom:v1 .

To make Dagu work with it you follow these steps:

  • run a local docker registry instance
docker run -d -p 5000:5000 registry:latest
  • tag your image so that you can push it to the local registry
docker image tag custom:v1 127.0.0.1:5000/custom:v1
  • push the image to the local registry
docker push 127.0.0.1:5000/custom:v1
  • use 127.0.0.1:5000/custom:v1 instead of custom:v1 in your dags

@x4204
Copy link
Contributor

x4204 commented Jul 13, 2024

Btw, ideally, there should be a an option to skip image pull here:

reader, err := cli.ImagePull(ctx, e.image, types.ImagePullOptions{})

Maybe something like this:

 executor:
   type: 'docker'
   config:
     image: 'custom:v1'
+    pull: false

@yohamta let me know what you think about this. I can submit a PR if you're interested

@yohamta
Copy link
Collaborator

yohamta commented Jul 14, 2024

Hi @x4204, thank you very much for providing the detailed workaround and the great suggestion about the option. This is really helpful. And yes, I would very much appreciate if you could submit a PR for adding the option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs-investigation More detailed look is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants