Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Does volume mounting support sockets, for example mounting docker.sock (docker runtime) for use with Portainer #422

Answered by AkihiroSuda
johnmccabe asked this question in Q&A
Discussion options

Hi,
I was trying to run Portainer but the process fails to communicate with the mounted docker.sock (I'm using the Docker runtime), is this something that should be feasible, I'm assuming volume mounting does not support sockets perhaps.

limactl start ./docker.yaml # used the example yaml
export DOCKER_HOST=unix://$HOME/docker.sock
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer -v $HOME/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Connecting to the UI, and pointing it at the mounted /var/run/docker.sock fails as it can't communicate with the mounted socket.

You must be logged in to vote

-v $HOME/docker.sock:/var/run/docker.sock

You probably meant -v /run/user/XXXXX/docker.sock:/var/run/docker.sock

Replies: 1 comment 1 reply

Comment options

-v $HOME/docker.sock:/var/run/docker.sock

You probably meant -v /run/user/XXXXX/docker.sock:/var/run/docker.sock

You must be logged in to vote
1 reply
Comment options

Ahh, I hadn't considered running from inside the lima vm, that works, and the port forwards are accessible from the OSX host. I had previously been attempting to run from the OSX host rather than in the vm.

limactl shell docker
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer -v /run/user/<your userid>/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

The UI is then accessible at https://localhost:9443 with, as you point out, the socket then being accessible in the portainer container at the mount point /var/run/docker.sock as expected.

Is allowing the socket forwarded to the host (what I originally tried) to be used something that you see being supported in future, would allow use cases like portainer to work identically to how they worked with Docker Desktop, ie without having to shell into the vm?

Thanks again for your help !!

Answer selected by johnmccabe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
Converted from issue

This discussion was converted from issue #421 on November 18, 2021 12:44.

AltStyle によって変換されたページ (->オリジナル) /