Code Monkey home page Code Monkey logo

Comments (4)

jjmaestro avatar jjmaestro commented on September 2, 2024

Huh, I just tried the following and it works!

$ docker run \
        --rm \
        --volume /var/run/docker.sock:/var/run/docker.sock \
        docker version

Client:
 Version:           27.1.1
 API version:       1.46
 Go version:        go1.21.12
 Git commit:        6312585
 Built:             Tue Jul 23 19:55:52 2024
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Desktop 4.33.0 (160616)
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:57:14 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.19
  GitCommit:        2bf793ef6dc9a18e00cb12efb64355c2c9d5eb41
 runc:
  Version:          1.7.19
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Then, I checked the Docker on Mac VM and sure enough, that's the docker socket inside the Linux VM.

from for-mac.

thaJeztah avatar thaJeztah commented on September 2, 2024

Yes, I think this is the expected behavior; bind mounts happen from the host where the daemon runs (on desktop, that's inside the VM); the socket on the host is a proxy for that socket, and also handles various conversions (host paths to vm paths etc), so to access the daemon socket, using the standard (/var/run/docker.sock) path should be the way to go

from for-mac.

jjmaestro avatar jjmaestro commented on September 2, 2024

@thaJeztah Sure, but then, how come I can bind mount e.g. a folder in my home directory? or any other path in Mac, for that matter? It's because / is mounted in /host_mnt/ inside the VM, correct? If so, that's why I would expect mounting the "outside socket" to work. Is there something else that's failing here?

from for-mac.

jjmaestro avatar jjmaestro commented on September 2, 2024

@thaJeztah is there a way to "run docker context list in the Docker VM"? For example, if I want to script getting the path to the socket in the VM, I can do this in e.g. Lima:

DOCKER_CONTEXT_VM="$(limactl shell "$VM_NAME" docker context show)"
DOCKER_HOST_VM="$(limactl shell "$VM_NAME" \
  docker context inspect --format "{{.Endpoints.docker.Host}}" "$DOCKER_CONTEXT_VM"
)"

Can I do something like that in the Docker VM? All I've found so far is "Getting a Shell in the Docker Desktop Mac VM" but I can't run docker context (or any docker command) in that shell.

Thanks!

from for-mac.

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.