Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux. Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting virtual machines.

The latest Docker version can be downloaded from:

Docker container


Operating system used
Windows Vista Home Premium SP 2

Software prerequisites
Docker on Windows

  1. Install and run a CentOS container, type: docker run -it centos /bin/bash

    Install CentOS container

    • i = interactive, t=assign pseudo-tty (aka terminal)
    • centos is the image the container will be based on. The container will be running a CentOS.
    • Run the application/process. In this example: /bin/bash in CentOS
    • A copy of the centos image was not found locally, so it is downloaded (=pulled) from Docker hub (the public Docker registry). For example:
      You can search the Docker Hub, see:
    • The CentOS base image is comprised of 3 layers: fd429..., 6941bf..., 41459f...
      These 3 layers needs to be downloaded.
    • Docker hub contains many different centos versions, each with its own tag. If you do not specify a tag in the run command docker run -it centos:<tag>, Docker will pull the centos image tagged with "latest".
    • If you use the run command and do not specify a name, a random name is automatically assigned.
      This random name can be found when using the command docker ps -a
      To assign a name, type: docker run -it --name mycentos centos /bin/bash

  2. A super lightweight barebone CentOS is installed. You can type Unix commands, for example:
    • Ping Google DNS: ping
    • Show running processes: ps -elf
    • Install vim: yum install -y nano

  3. Show the content of the hosts file, type: cat /etc/hosts

    CentOS hosts file

    The hostname "1900fc506c34" is the hosts file matches the PS1 prompt "root@1900fc506c34" which is also our container id.

  4. Create a test file, type: nano /tmp/test.txt and enter the text: Hello World

  5. Stop the container, type: exit

  6. Check if no containers are running, type: docker ps -a

    Exit CentOS container

    Our container id "1900fc506c34" is not running.

  7. Switch to root user, type: sudo su

  8. Go to the folder /var/lib/docker/aufs/diff/ where all containers are located.
    Type: cd /var/lib/docker/aufs/diff/

  9. Show the content of this folder, type: ls -al

    Container folder

    The hostname "1900fc506c34" is the hosts file matches the PS1 prompt "root@1900fc506c34".

  10. Go to the folder starting with "1900fc506c34".
    Type: cd 1900fc506c34...
    And show its content, type: ls -al

    Container id folder content

  11. The tmp folder will contain the test.txt file created earlier.

    Container folder with created file

  12. To start this particular container, type: docker start 1900fc506c34
    And attach to this container, type: docker attach 1900fc506c34

    Attach to running container

  13. You can still access the /tmp/test.txt file, type: cat /tmp/test.txt

  14. To exit a running container without killing it, press the keys: CTRL+P followed by CTRL+Q
    After pressing these buttons you will return to your Docker host.

    Pressing the keys CTRL+C in a running container, is the same as you type: exit.
    Both methods will stop the container.

    To attach to a running Docker process, type: docker attach <image id>
    Press the Enter key to get the promp back.