Unable to find image 'hello-world' locallyĥ65a9d68a73f: Pulling image (latest) from hello-world, endpoint: Download completeĪs you can see from the output, this command has pulled down the hello-world repository from (more on this in a later chapter) and printed the text "Hello from Docker." If you're seeing this message, then you've successfully installed boot2docker.
To test it out, try the command "docker run hello-world" from your host: $ docker run hello-world Once you've completed all these steps, you should have the Docker client installed and a VM capable of starting Docker containers. On windows, use the "environment variables" setting of the "Advanced system settings" tab On a Mac, add the following line to the ~/.bash_profile: export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 Since running the export command in the shell will only set the environment variable temporarily, you should follow the process on your OS to make it permanent. For example, here's what we'd run based on the output we got in the previous step: $ export DOCKER_HOST=tcp://192.168.59.104:2375
This address is the last line returned from the "boot2docker up" command. Here's an example: $ boot2docker upġ 13:38:00 Waiting for VM to be started.ġ 13:38:36 To connect the Docker client to the Docker daemon, please set:ġ 13:38:36 export DOCKER_HOST=tcp://192.168.59.104:2375įinally, you'll need to set an environment variable called DOCKER_HOST that will tell your Docker client on your host machine the URI for the Docker daemon running on the VM. The box will start the Docker daemon in the VM that listens for requests from the our client on our host. Think of this as turning your the new computer on. Once the box is created (it can take a few minutes because it has to download the image), you run boot2docker up to boot up the box. (Think of this as purchasing a new computer.) This will create a new Linux "box" called "boot2docker-vm" on your machine that has Docker installed, as well as configure some of the basic things you'll need to communicate with it from your host. Once the basic tools are installed, you're ready to create the box by running boot2docker init.
Next, you run the install procedure, which will install the boot2docker command line tool as well VirtualBox, a free tool from Oracle that allows your computer to run virtual machines.
You can find Mac and Windows installation instructions on the Docker's documentation site.
If you're unfamiliar with SSH or SSH keys, Appendix ? will give you details of how to get set up.įirst, download the installation package for your system.
Otherwise, you'll be prompted for a password whenever you log in. Install boot2dockerīefore you start, it's a good idea to first set up SSH on your host machine so that boot2docker can install your login credentials on the VM. Since both Docker and boot2docker are changing so rapidly, rather than describe the detailed steps here, I've provided an overview of the process so that you'll understand what's happening. This chapter will walk you through the installation process. The main difference is that our "docker" process is running inside a VM, rather than as a native service. If you've ever used a package like Postgres or MySql, it's exactly the same idea: you have a client tool that you use to issue commands to another server. So, the idea behind boot2docker is really quite clever: since we can't run Docker natively on Windows or a Mac, we install a bare-bones Linux VM that can run Docker, and then we communicate with it using a Docker client running on our host (i.e., the terminal on our main OS). For all intents and purposes, the VM is another computer running "inside" your computer - it has its own operating system, filesystem, and network that can piggyback on the resources of the host OS in an isolated environment. If you're unfamiliar with VMs, they let you run a "guest" operating system (like Linux) on your "host" operating system (like a Mac or Windows). To use it on a Mac or Windows, you must use a command-line tool called boot2docker that installs a Linux virtual machine (or "VM") on your system. Additional Resources Using boot2docker to run Docker on a Mac or Windowsĭocker's underlying containerization technology only works on Linux.