Search code examples
podman

How to mount a volume from a local machine on Podman


I'm trying to use Podman for local development. My idea is to use a local folder and sync it with the container where I'll be running my application.

I found that the -v option that I would use if I was working with Docker works with the server machine, as it says in the documentation -v Bind mount a volume into the container. Volume src will be on the server machine, not the client. Because of that, when I use that option the folder is not mounted and I can't find it when I access it using podman exec -it application bash

Is there a way I can sort this out? I want to something equivalent to:

docker run -v localFolder:/remoteFolder application

where localFolder is a path in my local machine, that will be mapped on remoteFolder on the container


Solution

  • podman machine stop podman-machine-default
    podman machine rm podman-machine-default
    
    podman machine init -v $HOME:$HOME
    podman machine start
    
    podman run -ti --rm -v $HOME:$HOME busybox