Docker

tugboatdockerWas at an IBM Cloud seminar this week and one of the hot new technologies discussed was Docker. I’ve heard of Docker for a year now, and it was great to get a couple of free Docker tshirts. I had been to a Google Youtube NYC Studios Happy Hour the night before — my third one — to pick up some energy and ideas, and did so — but the IBM event blew it away. I came away with energy and ideas and excitement, and two free Docker t-shirts. Plus they had free wine — good wine — and lots of horsdevoirs. IBM had the event of the week. They not only discussed Docker, but also OpenStack, Cloud Foundry, BlueMix, and Watson.

I came away with several action items, as provided to me by the guest speakers in a panel discussion at the end, when asked the question, “Where does one start?” The answers:

  1. Have lunch w IBM Bluemix Watson
  2. Download/install Docker & install app to it
  3. Join open stack (already a member)
  4. Join Cloudfoundry

Docker in process of being a revolutionary technology, surpassing VMWare. VMWare of course enables you to install a set of software applications to an operating system in a virtual computer, so you can pass the ‘image’ to someone, and they can simply starting using that software without going thru the arduous process of installing it themselves. VMWare’s big problem is that the VMWare images get HUGE — making them hard to download and pass around. Someone gives you a 35 GB image it could take 12 hours to download off some site. Then you put it on your computer and if you ‘only’ have a 500 GB hard drive, your VMWare images could eat up a big portion of that space in no time.

CDTWOXNUEAA9KZP

Docker provides ‘containers’ that allow you to transfer just the pieces that you need to recreate the installed set of applications, without the humungo image. It is likened to containers on a cargo ship. Just a container or two is what you need — not the whole ship. And the containers are preconstructed to ‘fit’ on cargo ships.

Docker

So I went up to Docker.com and attempted to download it, and found myself ‘steered’ toward their online tutorial. Here is what I learned — this is mostly their tutorial regurgitated, so I could understand it — because you learn things by writing them down sometimes.

  1. The Docker Engine consists of two parts: 1) a daemon (which is a server process that manages all the containers), and 2) a client (which acts as a remote control for the daemon). To check what version of Docker is running, you run the following command prompt: docker version
  2. The easiest way to get started is to use a container image from someone else. Container images are available on the Docker Hub Registry, a cloud-based collection of applications. You can find them online at Docker Hub as well through the Docker Engine client command line by typing in something like: docker search tutorial
  3. Container images can be downloaded easily usingdocker pull. For images in the Docker Hub Registry, the name you specify is constructed as <username>/<repository>.  — for example: docker pull learn/tutorial
  4. You can think of containers as a process in a box. The box contains everything the process might need, so it has the filesystem, system libraries, shell and such, but by default none of these are running. You ‘start’ a container by running a process in it. In the Docker tutorial, you are told to run the downloaded image and have it output “hello world” by running ‘echo’ in the container and have it say “hello world”. You do this by again going to the command prompt and typing in docker run learn/tutorial echo “hello world”. Note that the command docker run takes a minimum of two arguments: 1) an image name, and 2) the command you want to execute within that image.
  5. You can install a program to the Docker container. In the tutorial, you install a simple utility, ping, in the container. The image is based upon ubuntu, so the tutorial has you run the command docker run learn/tutorial apt-get install -y ping (in general, this is apt-get install -y ping) in the container. Note that even though the container stops right after a command completes, the changes are not forgotten.
  6. After you make changes (by running a command inside a container), you want to save those changes. This will enable you to start from this point later. With Docker, the process of saving the state is called committing. Commit basically saves the difference between the old image and the new state. In the tutorial, you are told to run docker ps -l to find the ID of the container you created by installing ping. it gives an id of 6982a9948422. Then in the tutorial you are told to save (commit) this container with the repository name ‘learn/ping’ by typing docker commit 698 learn/ping. Giving just docker commit will show you the possible arguments. You will need to specify the container to commit by the ID you found You don’t need to copy (type) the entire ID. Three or four characters are usually enough.
  7. At this point in the tutorial, you have built a complete, self-contained image with the ‘ping’ utility installed. You are told that your image can now run on any host that runs Docker. You are told to run docker run learn/ping ping google.com to ping google.com.
  8. At this point in the tutorial, your image is a running container. Using docker ps you can see a list of all running containers, and using docker inspect. you can see useful information about this container. In the tutorial, you run docker ps to find efefdc74a1d5 is a running container id, and then you run docker inspect efe to inspect it (you can specify a container using the first three or four characters of its ID).
  9. In the final step of the tutorial, you are told that now that you have verified that your image works, you can share it with others. Remember that you pulled (downloaded) the learn/tutorial image from the Registry? By pushing (uploading) images that you build, you can easily retrieve them to use on other hosts as well as share them with other users. docker images will show you which images are currently on your host. docker push is the command to push images. This emulator is logged in as user ‘learn’. You can only push images to your own namespace.

Be the first to comment

Leave a Reply

Your email address will not be published.


*