docker / machine

Machine management for a container-centric world

Home Page:https://docs.docker.com/machine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zsh: command not found: docker error (my first installation)

vinnytwice opened this issue · comments

I'm getting into Docker and as my Catalina system doesn't support virtualisation

If you work primarily on an older Mac or Windows laptop or desktop that doesn’t meet the requirements for the new Docker Desktop for Mac and Docker Desktop for Windows apps, then you need Docker Machine to run Docker Engine locally.

Currently, there is no docker-machine create driver for HyperKit, so use the virtualbox driver to create local machines. (See the Docker Machine driver for Oracle VirtualBox.) You can run both HyperKit and Oracle VirtualBox on the same system.

I'm using docker-machine using VirtualBox.

I followed the installation guide at https://docs.docker.com/machine/install-machine/ and got to the point that I can create a new machine with docker-machine create --driver virtualbox default command and it appears when linking machines with docker-machine ls.
Then

To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env default

so I run it and the command is

Run this command to configure your shell:
eval $(docker-machine env default)

run that too so as Docker's docs continue I should be able to run Docker commands like the suggested docker run busybox echo hello world but I get zsh: command not found: dockererror message.

The exact steps I used following the Docker docs are:

0 Install Docker Desktop 

1 enable writing on the /usr/local/bin folder for user

sudo chown -R $(whoami) /usr/local/bin  

2 install Docker-Machine

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
  chmod +x /usr/local/bin/docker-machine

3 install Xcode CLi..manually from dev account

4 Install Home Brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"


5 Install wget ( Using Brew)

brew install wget

6 Install bash completion scripts

base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
  sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done

7 enable the docker-machine shell promp

  1: vim ~/.bashrc

   2: i

  3: Pasted this:

PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '

4: press esc
5: press :
6: type wq! and press enter


Install VirtualBox, ExtensionPack and SDK


https://www.virtualbox.org/wiki/Downloads

Done!

I thought that the problem was that I added PS1='[\u@\h \W$(__docker_machine_ps1)]\$ ' to the .bashrc file instead that to .zshrc as I'm on Catalina so I corrected it and quitted Terminal. Reopened it and now terminal shows [\u@\h \W$(__docker_machine_ps1)]\$ as instead of vinnytwice@Vinnys-iMac ~ %(is this looking right?).
I re run the docker-machine ls and listed correctly the previously created virtual machine so I connected again the shell to it with eval $(docker-machine env default)but when running docker command docker run busybox echo hello world still same zsh: command not found: docker error ..
Can you see why is not running docker commands?
As always many thanks

ok..finally found the problem..as the error message states.. there is no Docker CLI installed.. I thought that installing Docker desktop would also install it as the docker-machine installation guide stated to install that, but I guess it meant for virtualisation capable machines..not my case.. So installed it with brew command brew install docker and it's al there working now.
Also the PS1='[\u@\h \W$(__docker_machine_ps1)]\$ ' setting goes indeed in the .bashrc file not the .zshrc.
Hope it helps other starting out..