Create an NGINX docker Container on Windows Pro

×

Start Reading

Create the Container

Validate Versions

C:\Windows\SysWOW64> docker version
Client: Docker Engine - Community
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:47:51 2018
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:55:00 2018
  OS/Arch:          linux/amd64
  Experimental:     false
  
Windows Version   
d:\dev\myProjects\dobby-the-companion> systeminfo
Version  
Host Name:                 DESKTOP-7V4CT9V
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.17134 N/A Build 17134

Create an nginx Container and map a host volume

C:\Users\Helmut> docker run  -d -p 80:80 -v c:/docker/nginx:/usr/share/nginx/html --name webserver nginx
dd17f5970d4f18d94ab01b04e2eb59cbe681745381502469a1dadc6dc76d2c65

Create a test HTML File and veriy NGINX setup with curl
C:\docker\nginx>  cat t1.html

Hallo Helmut

D:\docker\nginx> curl localhost:80/t1.html

Hallo Helmut

Login into Docker Container and install some Network tools

D:\dev\Tutorials> docker exec -it webserver /bin/bash
Install add. packages 
root@438da12bf45f:/# apt-get update
root@438da12bf45f:/# apt-get install iputils-ping
root@054a8e0a293e:/# apt-get install net-tools

root@054a8e0a293e:/# uname  -a
Linux 054a8e0a293e 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux

List all available Containers

  
C:\Users\Helmut>  docker container ls --all
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES
dd17f5970d4f        nginx             

Potential Poblems

Cannot Share Drive in Windows 10

Problem Description  
I also cannot add my shared drive in some instances. I enter the Docker application in the bottom right of Windows, click Settings 
> Shared Drives, select my chosen drive “C:”, and then when prompted for my password I correctly enter my password.

My username is also correct.

It just bloody resets to unticked.
Sometimes it works, but it requires resetting after every time I log out and back in.
Docker version 18.09.0, build 4d60db4
Windows 10 Pro - 1803 - Build 17134.472

Current WA : Use drive C: for mapping HOST directories 

Image docker_map_driver_fehler.jpg NOT Found

Deploy an Angular App to NGINX Docker Webspace on Window Pro

d:\dev\myProjects\dobby-the-companion> ng build --base-href /dobby-the-companion/
d:\dev\myProjects\dobby-the-companion> scp -r  dist\dobby-the-companion  c:\docker\nginx\

Testing Angular App
Webserver URL: http://localhost/dobby-the-companion/

Angular router Details
const appRoutes: Routes = [
  { path: '', redirectTo: '/login', pathMatch: 'full' },
  { path: 'login', component: LoginComponent },
  { path: 'goals', component: GoalsComponent, canActivate: [AuthGuard] },
];

http://localhost/dobby-the-companion/ -> will be redirect to component: LoginComponent