Docker Overview

Docker is the most popular and open source platform which can install and execute distributed applications for developers, testers and system administrators. You can think it as a light weight container. It includes all the necessary libraries that your application need to run. It is something like VM(Virtual Machine), but it is light weight. It do not need to separate a physical machine’s resource into several pieces for different VM to use. It just run in the physical machine and use the entire physical resources of the machine. This can reduce resource cost idle time and make the management easier.

docker vs virtual machine

Docker Advantage

  1. Light weight and easy to management.
    If you want to add a new test environment such as selenium grid node, you just need to use one command line to download and setup a prepackaged image which include all the libraries that a selenium grid node needs. Docker official website provide a lot of prepackaged images. But with VM you need to install a separate VM image and need to install all of the software you need to run in the VM one by one, it is so complex and inefficiency.
  2. Quick startup and less resource cost.
    Because start / restart a container do not need to start / restart operating system, so the start / restart time is short than VM. It is just a container, multiple containers can share resources even libraries with each other in the physical machine, so the resource cost and idle time is low.
  3. Easy to add new node in selenium grid.
    If you want to run your selenium test scripts in parallel, and you need a lot of Node server, with docker add a new Node is just a line of command. Because it’s official website repository has already package all type of Nodes that you need. Such as Chrome Node Image, Firefox Node Image.
  4. Large amount of prepackaged images.
    Please click here to go to the package repository page. You can explore and search for the package which you want to use.
    docker package repository
  5. Image package size is far smaller than VM.
    Because containers can use libraries that physical machine provides, so the package do not need to includes those library files. This make package size small, commonly only tens of MB.
  6. It can be installed and run in multiple platform, include Windows, Mac, Linux and even in cloud providers such as amazon AWS and Microsoft Azure.
READ :   Selenium XPath Css Selector Example

Setup Docker

Before use you need to install it first. You can click here to go to the download page and click menu “Get Docker” to choose the best one for your operating system.

docker setup page

If you use windows 10 professional,  click the blue button with text “Get Docker” to download it.

download docker for windows10 and older windows version

If you use older windows version, you need to click here to get Docker Toolbox which can run it in other windows except windows 10.

download docker toolbox for older windows version

I just installed Docker Toolbox for windows because my os is windows 7, you can click here to get help documents for installation.

After install you need to click “Quickstart Terminal” shortcut icon on desktop or windows startup menu to initiate and start the docker machine in windows.

start docker server

When you click the shortcut above, a dos command console will popup. First it will create a default docker machine where all the containers run in.

After started run “docker info” in the command console to verify that the installation and startup success.

docker install and start up success

After execute command “docker info”, it will list all the information about all the containers such as numbers of container, status of each container etc.

Startup issue

If you meet following error when start it in dos terminal.

start docker terminal error can not get ip

You need to run command “docker-machine rm default” in terminal, this will remove the default docker machine and when you restart the terminal again, it will create a new machine again.

Run Containers In Docker Machine

Now the docker machine is start up and running, you can download and install containers in it to run.

READ :   AutoIT Example - Upload File In Selenium Webdriver

Example: Install a web server container.

1: Setup nginx.

Execute “docker run -d -p 8088:80 –name webserver nginx” in terminal to install a nginx web server.

install webserver nginx container in docker

-d : Means this container will run at back ground as a daemon.

-p : Map physical machine port to docker container listening port, we all know web server listen on 80 port in the container, but if the physical machine’s 80 port is used by other program, we should use -p to point out a usable port which can be used to access the web server container from physical machine.

–name: Give the container a name, in this example then name is webserver.

nginx: is the package name of the container.

After install you can use “docker ps -a” to list all the containers installed in this machine. Please see the list in above picture.

2. Browse nginx webserver.
Use following url “” to see the nginx webserver installation success page as following picture.

nginx webserver container installed in docker success page

Please notice the ip of the url. It is just the docker machine’s ip. You can see it when you start docker machine for the first time.

docker machine's ip

Manage Containers Use Kitematic

Kitematic is a GUI program which can be used to manage and change containers’s properties.

Click Kitematic icon in the desktop or startup menu to start it.

start docker windows gui

In below picture you can see your installed nginx container listed in left panel. Click it then the right panel will show it’s detail info. Click “Settings” tab in right panel, then click “Hostname / Ports” tab, then go to “Configure Ports” area to change the container mapping port. You will also see the docker machine’s ip before the port number.

manage docker container and change nginx container's mapping port

You can perform a lot of actions to the container in the GUI tool such as stop, restart, remove, open power shell to execute commands. In next article we will show you how to use Docker to easily setup selenium grid.

(Visited 353 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.