I’ve been running a lot of stuff in containers, but it seems some basic knowledge is still lacking… ;(
I have coreos running on an old headless atom pc. Just for fun. Currently toolbox is broken on coreos.
Normally on my silverblue laptop I run neovim from a toolbox container on host files with an alias and this works great!
alias nvim=“toolbox run -c apps nvim”
If my current working directory is anywhere on the host I can run
nvim ~/bin/sript.sh
or if im in the .config directory I can just type
nvim configfile
and edit and :wq.
But on my coreos(and same on silverblue) I created an ‘apps’ image, and trying to reproduce the same functionality as toolbox.
I am able to mount my home directory with no permission problems. But if I am in the .config directory and type nvim configfile, it will not open the file, but rather create a new configfile in the home directory. If I don’t set WORKDIR in the dockerfile it will try to create the file in /
My container curently has no WORKDIR or ENTRYPOINT defined in the Dockerfile. I have this wrapper script:
[core@zbox bin]$ cat nvim
#!/bin/bash
podman run -it --rm \
--privileged \
--net host \
--security-opt label=disable \
--userns=keep-id \
--user=1000:1000 \
--name apps \
-v /home/me:/home/me:z \
apps nvim $@
[core@zbox bin]$
What magic is toolbox doing to respect either the path or current directory? Any better way of doing this?