Today I was stricken by some strange behaviors when working with Docker on Windows 7. Firstly , the docker fails to initialize, either stuck at initialization or starting. This I was able to solve by manual stop the virtual box headless process in the process manager, and then restart the boot2docker.
However, subsequently, i encountered a weird message after i was able to launch and login to boot2docker. That is, whenever i tried any docker command, the message said:
sh: docker: command not found
The message in the CLI indicates the docker should be usable. I tried several methods including delete the docker vm and restart boot2docker, but to no effect. I went on goolging but there seems to be no mentioning of solution, the docker site mentions it may has something to do with docker installation being incorrect. However, the docker i am using has been running all the time without any problem until today.
The cause of the problem finally surfaced when i run the following command:
> echo $PATH
The printed out path indicates that docker and git are not found on the path, although i have added them much earlier during docker installation. Some closer examination showed that the entire path variable defined for user is not included in %PATH%.
After some investigation, it turned out that i installed the Visual SVN server and TortoiseSVN for some testing today, and their directory path are added to the system path variable during installation. this cause the system path variable to become too long. As a result, the Windows OS silently drop the user path variable, only keeping the system path variable in the %PATH%.
The solution after knowing this is simple, i uninstall some application no long in use and remove their directory from the system path variable so that my system path variable won't be too long. After this, restart the boot2docker, and the problem disappear.