Docker - (Virtual) Host (or Machine or Server) - Docker Type

Card Puncher Data Processing

About

A host in docker can be:

  • a machine where docker server run
  • or a network

This page is about the machine, to see the network, see the page Docker - Host Network.

An host (or machine) is:

  • a virtual host that you can see running in your virtual machine provider (such as virtual box).
  • is managed through the docker-machine executable (creation, start, stop,…)

The host operating system is boot2docker.

Docker Host Virtualbox

Management

Environment variable

Windows DOS shell

docker-machine env
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\gerard\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('"C:\DockerToolbox\docker-machine.exe" env') DO @%i

Linux bash shell

docker-machine env --shell=bash
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="C:\Users\gerard\.docker\machine\machines\default"
export DOCKER_MACHINE_NAME="default"
export COMPOSE_CONVERT_WINDOWS_PATHS="true"
# Run this command to configure your shell:
# eval $("C:\DockerToolbox\docker-machine.exe" env --shell=bash)

List

docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER   ERRORS
default            virtualbox   Timeout

where:

Driver

The driver indicate the provider on which to create the machine (ie the virtual engine).

Example:

See the Full List

You can register an already existing docker host by passing the daemon url.

docker-machine create --driver none --url=tcp://50.134.234.20:2376 custombox
docker-machine ls
NAME        ACTIVE   DRIVER    STATE     URL
custombox   *        none      Running   tcp://50.134.234.20:2376

Name

The environment variable DOCKER_MACHINE_NAME has the name of the host machine.

By default, you may find Moby because docker-compose comes from the Moby Project. This is the name that we will find in the host file (/etc/host) in the docker-compose service.

How to find your host name:

  • The DOCKER_MACHINE_NAME env variable
$ echo $DOCKER_MACHINE_NAME
default

  • Otherwise you see it in the NAME column when you list your hosts. See list

IP

Three ways to find the IP dependent of your configuration

Name

On windows, you can use the name host.docker.internal to reach the host.

Nat

If you are using a NAT, to determine the Docker Windows host IP interface (By default, this is the interface named vEthernet (DockerNAT) on the IP 10.0.75.1)

  • at the command line with netsh
netsh interface ip show addresses
# and to filter for one interface
netsh interface ip show addresses "vEthernet (DockerNAT)"
Configuration for interface "vEthernet (DockerNAT)"
    DHCP enabled:                         No
    IP Address:                           10.0.75.1
    Subnet Prefix:                        10.0.75.0/24 (mask 255.255.255.0)
    InterfaceMetric:                      15

  • Windows graphically

Docker Host Ip Nat

Docker Machine

docker-machine ip default
192.168.99.100

The DOCKER_HOST environment variable contains also the IP adress of the host

This IP is assigned by the docker-machine create subcommand.

Info !

docker info                                                                                            
Containers: 35                                                                                           
 Running: 1                                                                                              
 Paused: 0                                                                                               
 Stopped: 34                                                                                             
Images: 45                                                                                               
Server Version: 1.12.3                                                                                   
Storage Driver: aufs                                                                                     
 Root Dir: /mnt/sda1/var/lib/docker/aufs                                                                 
 Backing Filesystem: extfs                                                                               
 Dirs: 186                                                                                               
 Dirperm1 Supported: true                                                                                
Logging Driver: json-file                                                                                
Cgroup Driver: cgroupfs                                                                                  
Plugins:                                                                                                 
 Volume: local                                                                                           
 Network: bridge host null overlay                                                                       
 Log:                                                                                                    
Swarm: inactive                                                                                          
Runtimes: runc                                                                                           
Default Runtime: runc                                                                                    
Init Binary:                                                                                             
containerd version:                                                                                      
runc version:                                                                                            
init version:                                                                                            
Security Options:                                                                                        
 seccomp                                                                                                 
Kernel Version: 4.4.27-boot2docker                                                                       
Operating System: Boot2Docker 1.12.3 (TCL 7.2); HEAD : 7fc7575 - Thu Oct 27 17:23:17 UTC 2016            
OSType: linux                                                                                            
Architecture: x86_64                                                                                     
CPUs: 2                                                                                                  
Total Memory: 7.79GiB                                                                                    
Name: default                                                                                            
ID: 6CCC:JOTU:XXK3:ZJV6:7QTA:Y5LZ:EUAM:D3VM:XTVA:NQOY:5M2Z:KSC5                                          
Docker Root Dir: /mnt/sda1/var/lib/docker                                                                
Debug Mode (client): false                                                                               
Debug Mode (server): true                                                                                
 File Descriptors: 23                                                                                    
 Goroutines: 41                                                                                          
 System Time: 2017-10-24T15:05:24.245401217Z                                                             
 EventsListeners: 0                                                                                      
Registry: https://index.docker.io/v1/                                                                    
Labels:                                                                                                  
 provider=virtualbox                                                                                     
Experimental: false                                                                                      
Insecure Registries:                                                                                     
 127.0.0.0/8                                                                                             
Live Restore Enabled: false                                                                              

where you can see:

Disk Location

Docker Storage Locations

Data Persistence

Changes outside of the /var/lib/docker and /var/lib/boot2docker directories will be lost after powering down or restarting the host.

More ? See local customisation with persistent partition





Discover More
Architecture
Docker - Architecture

The docker architecture is composed of: an host where the daemon run a daemon that manage and run all Docker object (such as image and container) a registry to download and push image a docker...
Docker Shared Drive New Credentials
Docker - Bind mount

bind mount is type of mount. It's one of the three way on how you can persist data from a container. See The file or directory is referenced by its full or relative path on the host machine. The...
Card Puncher Data Processing
Docker - Boot2Docker

boot2docker/boot2dockerBoot2Docker is the kernel of the OS linux of the Docker Machine When you ssh in the host with docker-machine, you get the boot2docker prompt. tce-load...
Card Puncher Data Processing
Docker - Clean (Removing Image and Container)

Docker host disk sizing management. Docker stores all layers/images in its file formate (i.e. aufs) in default /var/lib/docker directory. Remove the container that where not used months ago See...
Card Puncher Data Processing
Docker - Context

where you get: the type (ie host) the endpoint the orchestrator is swarm
Docker Daemon
Docker - Daemon - dockerd

The daemon is: a self-sufficient runtime for containers. a background service running on the host that manages building, running and distributing Docker containers. The daemon creates and manages...
Card Puncher Data Processing
Docker - Data Persistence

mount a file or directory of the host into a container. volume: mount a file or directory of the host machine into a container located at /var/lib/docker/volumes/ : mount a file or directory of the...
Card Puncher Data Processing
Docker - Docker Root Dir (Docker Data Storage Path)

The docker root dir is the root path where all data docker is stored. Log into the host And select it where:
Card Puncher Data Processing
Docker - Host Environment ( OS )

Host environment variable A docker machine must have minimal OS environment value in order to function correctly. Output: The following list of environment variables are supported by the docker...
Card Puncher Data Processing
Docker - Host Network

An host net is a docker network. host machine The container’s network stack is not isolated from the Docker host. All containers in the host network are able to communicate with each other on the...



Share this page:
Follow us:
Task Runner