How To on Windows

Docker: Windows vs Linux

"In a Docker installation on Linux, your machine is both the localhost and the Docker host. In networking, localhost means your computer. The Docker host is the machine on which the containers run.

On a typical Linux installation, the Docker client, the Docker daemon, and any containers run directly on your localhost. This means you can address ports on a Docker container using standard localhost addressing such as localhost:8000 or 0.0.0.0:8376.

In a Windows installation, the docker daemon is running inside a Linux virtual machine. You use the Windows Docker client to talk to the Docker host VM. Your Docker containers run inside this host.

In Windows, the Docker host address is the address of the Linux VM. When you start the VM with docker-machine, it is assigned an IP address. When you start a container, the ports on a container map to ports on the VM." ~docs.docker.com

Important: Currently work on the tighter integration of Docker is in progress. Read Docker blog for more details. We have not tested his project with the beta yet.

Docker Installation

Installation of the platform is covered by an excellent Guide. This project does not require any special installation configuration and works perfectly with default settings (as of Toolbox version 1.11.1).

Running

CLI

To start the application run the same command as on Linux. The only difference is that it has to be issued from Docker Quickstart Terminal.

docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -p 8000:80 -it zmumichal/netlab-dockerized:latest

This should end up in the image downloaded and the container running.

Kinematic

The current version of Kinematic doesn't allow to set required run properties. Please start the application using CLI.

Accessing GUI

Kinematic

Launching GUI through Kinematic is available only if you ran the container with port forwarding (like through CLI with -p 8000:80 or with port forwarding set in GUI).

Open Kinematic and double-click web preview part to launch a browser window with the application.

Alternate way

If port forwarding is set, there is an another way to:

  1. Check IP of running container.
    • Open second instance Docker Quickstart Terminal
    • Run command: docker-machine ip
  2. Open ip_get_from_previous_command:8000 to access the GUI. That's it - everything should be working now.
Direct access

You can access the GUI without port forwarding set, but it requires adding routing rule to your OS. To add routing rule first you need to find out IP of the GUI. Assuming that your docker-machine has default configuration, all you need to do is to run:

route add 172.17.0.0 MASK 255.255.0.0 192.168.99.100

where:

  • 172.17.0.0 is the network of the default Docker bridge on the docker-machine; it can be found through docker inspect <container id>
  • 192.168.99.100 is the docker-machine IP; can be found through docker-machine ip

With route rule added

  • run the GUI container
  • find it's IP address (through docker inspect <GUI container id>)
  • use that IP in the browser (no port required as the GUI at default HTTP port)

Have in mind that you may not want to add routes and port forwarding approach is recommended.

Cleanup

If you want to remove created Docker containers, you could do it in two different ways.

Kinematic

Use Kinematic and after choose container to remove, simply click on remove button as showed on the screenshot.

CLI

Use Docker Quickstart Terminal and run docker rm command.

  • List all containers using docker ps command. Look for instance name.
  • If container is working, stop them using docker stop <instance_name> command.
  • Remove container using docker rm <instance_name> command.

Network cleanup

During the stopping project, all containers are removing with their networks. But if the project will be closed in an incorrect way, during the next run some problems with network could appear. To repair that remove previously created networks.

To remove networks:

  1. Run command docker network ls to list all networks.
  2. To remove selected network run command docker network rm <network name>
  3. Delete all netlabdockerized networks.

Image cleanup

Sometimes you would want to remove docker image from your local repository. Eg. If you want to ensure that, your image is up to date.

CLI

To remove docker image:

  1. Run docker images command to list all images in your local repository.
  2. Run docker rmi <image_name> command to remove chosen image.
Kinematic

To remove images using Kitematic:

  1. Click +NEW button.
  2. Select My Images tab.
  3. Click ... on chosen image.
  4. Click Delete tag

    Accessing the containers

    To access the containers you can follow three approaches.

Kinematic

To access the container from Kitematic, chose container and click Exec. It opens terminal connected to the chosen container.

CLI

You can access to container using CLI too. To connect client container use command:

docker exec -it <client-GUI-name> bash

To connect router container use:

docker exec -it <router-GUI-name> vbash
SSH

Use ubuntu/ubuntu as the credentials for the client and vyos/vyos for the router.

Using GUI networks/addresses

Accessing your containers through SSH with Windows requires adding route rule to make your containers visible from the Windows. The command:

route add <network> MASK <mask> <docker-machine IP>

will give you access to containers from the specified network (use the networks configured through GUI). Now you can ssh to the containers using addresses configured through GUI.

Using common bridge interface

You could also use the Docker bridge interface to access the containers, what results in adding one routing rule only. To do so, find the network of that bridge interface using docker inspect <router/client container id> and seek for entry starting with 172. (typically it will be 172.18.0.x. The use the network of that interface to add the rule, for instance:

route add 172.18.0.0 MASK 255.255.0.0 192.168.99.100

To ssh to a container use docker inspect to find out it's IP.

From docker-machine

Alternative to that approach involves using ssh from docker-machine (VM) as the containers are accessible from there. Run docker-machine ssh to swich to the Vm. Now you can ssh your router and client containers.

results matching ""

    No results matching ""