Code Monkey home page Code Monkey logo

Comments (6)

smaddock avatar smaddock commented on August 28, 2024 1

Yes, I got it working by installing Docker Desktop which setup /var/run/docker.sock. That is a workaround, though. Docker Desktop should not be a requirement for the Packer docker-push post-processor, as it is not for the builder or other post-processors. docker-push should correctly ascertain and use the active Docker endpoint based on the Docker context.

from packer-plugin-docker.

smaddock avatar smaddock commented on August 28, 2024

Just running into this myself, although I don't think it's specific to ECR. Rather it seems to be that docker-push does not respect the Docker context set nor have a way to specify the Docker context, and only uses the default context. Colima (and other container runtimes) specify alternate contexts as can be seen by running docker context ls. Example:

❯ docker context ls
NAME       DESCRIPTION                               DOCKER ENDPOINT
colima *   colima                                    unix:///Users/smaddock/.colima/default/docker.sock
default    Current DOCKER_HOST based configuration   unix:///var/run/docker.sock

This is why docker push works manually but the post processor does not. Note that this is a different issue than running Packer on a remote host... the host is still local; the socket is just in an alternate location.

from packer-plugin-docker.

smaddock avatar smaddock commented on August 28, 2024

Documentation: https://docs.docker.com/engine/context/working-with-contexts/

If we could set the DOCKER_CONTEXT environment variable, or the --context command-line argument like we can with run_command on the builder, that would work.

from packer-plugin-docker.

wawrzek avatar wawrzek commented on August 28, 2024

This might be a Mac specific problem. I just noticed that there is more than one context with Docker Desktop:

NAME              DESCRIPTION                               DOCKER ENDPOINT                                 ERROR
default           Current DOCKER_HOST based configuration   unix:///var/run/docker.sock
desktop-linux *   Docker Desktop                            unix:///Users/wawrzek/.docker/run/docker.sock

and Rancher Desktop has own:

rancher-desktop   Rancher Desktop moby context              unix:///Users/wawrzek/.rd/docker.sock

I'll check @smaddock your suggestion to set DOCKER_CONTEXT.

from packer-plugin-docker.

wawrzek avatar wawrzek commented on August 28, 2024

After setting the DOCKER_CONTEXT I see now a different error:

    docker.eigenlayer (docker-push): Failed to initialize: unable to resolve docker endpoint: context "desktop-linux": context not found: open /var/folders/l4/0bhk3tfj2dqg60yp93c7dtl00000gn/T/packer1747910882/contexts/meta/fe9c6bd7a66301f49ca9b6a70b217107cd1284598bfc254700c989b916da791e/meta.json: no such file or directory
    docker.eigenlayer (docker-push): Removing temporary Docker configuration directory

from packer-plugin-docker.

wawrzek avatar wawrzek commented on August 28, 2024

During further investigation, I fixed the default context in Docker Desktop. In my case it was pointing ad the socket from Rancher Desktop which was broken. I deleted '/var/run/docker.sock', disabled and then re-enabled Allow the default Docker socket to be used (requires password) option in the Docker Desktop Advance Settings. Default context (builder in Docker Desktop) was fixed, and then I can run packer normally.

I suggest anyone with the problem to check if /var/run/docker.sock is valid and enabled in Docker Desktop.

from packer-plugin-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.