Setting up Docker on Windows

As we know Docker is a popular software package that creates a container of application development. Docker uses Os-level virtualization to install software packages called containers.

Containers are isolated from one another and bundle their won software, libraries and configuration files.

You can install Docker Toolbox from the following link:

To download the latest version of Docker tool box you should select the right release version with ‘.exe’ file. After downloading the file, just follow the instructions on the setup wizard.

Select Docker ‘Quick Docker start’ icon to make configuration for Docker Toolbox Terminal.

Docker-tool-box

Checking for Installed Images

  • docker ps
  • docker ps -a

Terminal for docker toolbox requires ‘bash’ environment instead of standard windows command prompt.

Installing Latest Version of Ubuntu on this Docker Toolbox

  • $ docker run -it -p 8080:80 –name cit480 ubuntu:latest bash

Writing your first Docker File

To create a docker image we first need to create a Docker file. By using different instructions and arguements we will create a docker file.

First step

We will create an image with contents of the website with ‘curl’ and store it in a text file.

  • FROM ubuntu:latest
  • RUN pat-get update && apt-get install –no-install-recommends –no-install-suggests -y curl && rm -rf /var/lib/apt/lists/*
  • ENV SITE_URL http://example.com/
  • WORKDIR /data
  • VOLUME /data
  • CMD sh -c “curl -Lk $SITE_URL > /data/results”

Second Step

Change the directory to ‘examples/curl’ directory and execute the following command:

  • docker build . -t test-curl
  • HERE, docker build command builds a new IMAGE locally
  • -t flag sets the name tag to an IMAGE

CHECK THE IMAGES

  • docker images