SelfhostedPro / Yacht

A web interface for managing docker containers with an emphasis on templating to provide 1 click deployments. Think of it like a decentralized app store for servers that anyone can make packages for.
MIT License
3.45k stars 169 forks source link

[Bug Report] ~/ not being handled correctly in Bind Mounts #435

Closed Narflar closed 2 years ago

Narflar commented 2 years ago

Describe the bug if I set a bind mount to ~/ ,Yacht is registering that as /config instead of /home/user. When I use docker-compose directly ~/ is being treated as home.

To Reproduce Running the below docker-config.yml in Yacht Project and Docker-Compose produce two different results.

    volumes:
        - ~/.docker/data/speedtest:/config

Expected behavior

I expect Yacht to mirror how Docker-Compose handles the home shortcut

Screenshots

When I inspect the container that was installed via Yacht Project I see the following

"Binds": [ "/config/.docker/data/speedtest:/config:rw" ],

When I inspect the container that was installed via docker-compose I see the following

"Binds": [ "/home/user/.docker/data/speedtest:/config:rw" ],

Desktop (please complete the following information):

Additional context I set PUID and GUID to 1000 when installing Yacht

SelfhostedPro commented 2 years ago

Yacht is running inside of a container, therefor it has no idea what your user account is or where home is.

You can set a template variable for !home to an absolute path to your home directory (ie. /home/user/) and use that in templates.

For projects, you’ll want to use an absolute path as that is the recommended best practice from the docker-compose maintainers iirc.

SelfhostedPro commented 2 years ago

/config is the “home” of the yacht container which is why you’re seeing that specific path.

Narflar commented 2 years ago

Ok, that makes sense. I couldn't figure out why things were working differently. Thank you!

SelfhostedPro commented 2 years ago

You could probably sort it out by passing the $HOME environment variable to The Yacht container with the value you want ~ to have.