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 by PermitUserEnvironment yes in sshd_config).

https://unix.stackexchange.com/q/332532/341457

Share:
11,438

Related videos on Youtube

chrwahl
Author by

chrwahl

Updated on September 18, 2022

Comments

  • chrwahl
    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
      Lutz over 4 years
      have you tried ssh user@host '/snap/bin/docker info'?
    • chrwahl
      chrwahl over 4 years
      Thanks @Lutz. That works! So, I'm missing a link somewhere? Would be nice if I could just write 'docker'.
    • Lutz
      Lutz over 4 years
      Yes the link is that snap installs everything in /snap and if you just ssh into the server this is not part of the environment variable PATH. This variable is used for searching executable files, if no path is given(e.g. calling docker vs /snap/sbin/docker).