I\'m trying to learn about Docker, but I keep getting cryptic (to me) error messages.
Possibly the simplest example of this is trying to print the version of Docker
TLDR: This got my Python meetup group past this problem when I was running a clinic on installing docker and most of the users were on OS X:
boot2docker init
boot2docker up
run the export commands the output gives you, then
docker info
should tell you it works.
The Context (what brought us to the problem)
I led a clinic on installing docker and most attendees had OS X, and we ran into this problem and I overcame it on several machines. Here's the steps we followed:
First, we installed homebrew (yes, some attendees didn't have it):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then we got cask, which we used to install virtualbox, and then used brew to install docker and boot2docker (all required for OS X) Don't use sudo for brew.:
brew install caskroom/cask/brew-cask
brew cask install virtualbox
brew install docker
brew install boot2docker
The Solution
That was when we ran into the problem the asker here got. The following fixed it. I understand init was a one-time deal, but you'll probably have to run up every time you start docker:
boot2docker init
boot2docker up
Then when up has been run, it gives several export commands. Copy-paste and run those.
Finally docker info should tell you it's properly installed.
To Demo
The rest of the commands should demo it. (on Ubuntu linux I required sudo.)
docker run hello-world
docker run -it ubuntu bash
Then you should be on a root shell in the container:
apt-get install nano
exit
Back to your native user bash:
docker ps -l
Look for the about 12 digit hexadecimal (0-9 or a-f) identifier under "Container ID", e.g. 456789abcdef. You can then commit your change and name it some descriptive name, like descriptivename:
docker commit 456789abcdef descriptivename`