bash: docker: command not found
11,438
Create a symlink:
sudo ln -s /snap/bin/docker /usr/bin/docker
You could also check what your path variable shows using the same command, but instead of ls -l
use echo $PATH
command. You could try to place symlinks to PATH mentioned there.
Set the
PATH
on the server in~/.ssh/environment
(needs to be enabled byPermitUserEnvironment yes
insshd_config
).
https://unix.stackexchange.com/q/332532/341457
Related videos on Youtube
Author by
chrwahl
Updated on September 18, 2022Comments
-
chrwahl almost 2 years
I'm accessing Ubuntu 19.10 running as a virtual machine. In the installation process I installed Docker (as a snap). Everything is fine when I log in using SSH, but this will fail:
$ ssh user@host 'docker info'
returning:
bash: docker: command not found
. Other commands like$ ssh user@host date
or$ ssh user@host 'ls -l'
woks fine.Any suggestions?
-
Lutz over 4 yearshave you tried ssh user@host '/snap/bin/docker info'?
-
chrwahl over 4 yearsThanks @Lutz. That works! So, I'm missing a link somewhere? Would be nice if I could just write 'docker'.
-
Lutz over 4 yearsYes the link is that snap installs everything in
/snap
and if you just ssh into the server this is not part of the environment variablePATH
. This variable is used for searching executable files, if no path is given(e.g. callingdocker
vs/snap/sbin/docker
).
-