cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
379
Views
25
Helpful
2
Replies
clogsdon
Cisco Employee

Tips for Installing YANG Suite Docker on Windows 10

Introduction

This article shows you how I installed YANG Suite Docker on Windows 10.  I had a few challenges and incorporated their fixes into my procedure.

TL;DR

Prereqs for my procedure

  • Windows Subsystem for Linux (WSL2)
  • Docker Desktop for Windows
  • openssl
  • dos2unix

I installed YANG Suite in C:\yang where I keep all my YANG modules and software.   Pick whatever Windows folder is good for you.

Tool

Action

Notes

PowerShell terminal

Clone YANG Suite

PS C:\yang> git clone https://github.com/CiscoDevNet/yangsuite

 

Text editor

Edit yangsuite/docker/docker-compose.yml.

  • change nginx ports from 80:80 and 443:443, e.g., 8480:80 and 8443:443
  • optional: change yangsuite admin username/password

nginx requires different port bindings because the Windows System process is bound to port 80.

WSL2 Ubuntu terminal

Generate self-signed certificate and key.

/mnt/c/yang/yangsuite/docker$ ./gen_test_certs.sh

Windows 10 does not have openssl from a trusted source.   I used Ubuntu on WSL2.

git bash or WSL2 Unbuntu terminal

Convert Windows CRLF to Unix LF

clogsdon@CLOGSDON-WG6RJ  MINGW64 /c/yang/yangsuite (develop)

$ find . -type f -print0 | xargs -0 dos2unix

The github files have Unix LF, but cloning them to Windows seems to change LF to Windows CRLF. 
I used git bash b/c it was installed on my laptop and it has dos2unix.  Alternatively, you can install dos2unix on WSL2 Ubuntu with sudo apt-get install dos2unix.

PowerShell terminal

Build the yangsuite docker containers

PS C:\yang\yangsuite\docker> docker-compose up

If you get an error that says registry-1.docker.io on 192.168.65.1:53: no such host, then look at the Problem Encountered  section below.

Web browser

Open YANG Suite.

https://localhost:8443

 

 

Problems Encountered and Their Fixes

Each of these errors caused my first few attempts to fail.

lookup registry-1.docker.io on 192.168.65.1:53: no such host

Building yangsuite
Step 1/19 : FROM ubuntu:18.04
Service 'yangsuite' failed to build : Head  https://registry-1.docker.io/v2/library/ubuntu/manifests/18.04: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such host

What worked for me:  I had this problem when installing over my corporate VPN.  After I shut down the VPN and connected to the public Internet, I was able to install cleanly. 

What worked for others:  Look at the hosts file workaround in YANG Suite docker install on Windows 10.

 

Cannot start service nginx: Ports are not available: listen tcp 0.0.0.0:80

ERROR: for nginx  Cannot start service nginx: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

Solution:  Change the nginx default ports in yangsuite/docker/docker-compose.yml.

 

standard_init_linux.go:219: exec user process caused: no such file or directory

This error occurs when Linux encounters CRLF instead of LF in a text file.  

backup_1     | standard_init_linux.go:219: exec user process caused: no such file or directory
yangsuite_1  | standard_init_linux.go:219: exec user process caused: no such file or directory

Solution:   Run dos2unix on all files in the yangsuite directory. 

 

Installation Details

My Environment

  • Windows 10 Enterprise, version 1909, build 18363.1082
  • WSL2 with Ubuntu 20.04 distro
  • Docker Desktop for Windows, version 3.1.0 (51484), with default settings except for
    • Settings => General => Use the WSL 2 based engine
    • Settings => Resources => WSL Integration => Enable integration with additional distros => Ubunt

 

Step 1.  Clone YANG Suite from github

Open a PowerShell terminal.

PS C:\Users\clogsdon> cd C:/yang
PS C:\yang> git clone https://github.com/CiscoDevNet/yangsuite
Cloning into 'yangsuite'...
remote: Enumerating objects: 702, done.
remote: Counting objects: 100% (702/702), done.
remote: Compressing objects: 100% (470/470), done.
remote: Total 702 (delta 268), reused 608 (delta 215), pack-reused 0
Receiving objects: 100% (702/702), 24.95 MiB | 4.43 MiB/s, done.
Resolving deltas: 100% (268/268), done.

 

Step 2.  Generate the nginx certificate and key

I used WSL2 Ubuntu because it has openssl and can access the Windows directories.

cl@CLOGSDON-WG6RJ:/mnt/c/Users/clogsdon$ cd /mnt/c/yang/yangsuite/docker
cl@CLOGSDON-WG6RJ:/mnt/c/yang/yangsuite/docker$ ./gen_test_certs.sh
################################################################
## Generating self-signed certificates...                     ##
##                                                            ##
## WARNING: Obtain certificates from a trusted authority!     ##
##                                                            ##
## NOTE: Some browsers may still reject these certificates!!  ##
################################################################
Generating a RSA private key
........................+++++
.............+++++
writing new private key to 'nginx/nginx-self-signed.key'
-----
cl@CLOGSDON-WG6RJ:/mnt/c/yang/yangsuite/docker$ ls -l ./nginx/nginx-self-signed*
-rwxrwxrwx 1 cl cl 1115 Feb 17 20:23 ./nginx/nginx-self-signed.cert
-rwxrwxrwx 1 cl cl 1704 Feb 17 20:23 ./nginx/nginx-self-signed.key

 

Step 3.  Change the nginx default ports

Use any text editor.  Use any new port numbers you want.  I used 8480 and 8443.

    nginx:
      image: nginx:latest
      build:
        context: ./nginx
      depends_on:
        - yangsuite
      ports:
        - "80:80"     <== change to "8480:80"
        - "443:443"   <== change to "8443:443"

 

Step 4.  Convert Windows CRLF to Unix LF

You can install dos2unix in WSL2 Ubuntu.  I used git bash because it already had dos2unix.

clogsdon@CLOGSDON-WG6RJ MINGW64 ~
$ cd /c/yang/yangsuite

clogsdon@CLOGSDON-WG6RJ MINGW64 /c/yang/yangsuite (develop)
$ find . -type f -print0 | xargs -0 dos2unix
dos2unix: converting file ./.coveragerc to Unix format...
dos2unix: converting file ./.git/config to Unix format...
dos2unix: converting file ./.git/description to Unix format...
<full output ommitted to save space>

 

Step 5.  Build the yangsuite containers

Go back to the PowerShell terminal.

PS C:\yang\yangsuite\docker> docker-compose up
Creating network "docker_default" with the default driver
Building yangsuite
Step 1/19 : FROM ubuntu:18.04
18.04: Pulling from library/ubuntu
d519e2592276: Pull complete
d22d2dfcfa9c: Pull complete
b3afe92c540b: Pull complete
Digest: sha256:ea188fdc5be9b25ca048f1e882b33f1bc763fb976a8a4fea446b38ed0efcbeba

<cut>

yangsuite_1  | *** uWSGI is running in multiple interpreter mode ***
yangsuite_1  | spawned uWSGI master process (pid: 35)
yangsuite_1  | spawned uWSGI worker 1 (pid: 39, cores: 1)
yangsuite_1  | spawned uWSGI worker 2 (pid: 40, cores: 1)
yangsuite_1  | spawned uWSGI worker 3 (pid: 41, cores: 1)
yangsuite_1  | spawned uWSGI worker 4 (pid: 42, cores: 1)
yangsuite_1  | spawned uWSGI worker 5 (pid: 43, cores: 1)

The YANG Suite installation is now complete.

Docker Desktop will show three containers, docker_yangsuite_1, docker_backup_1, docker_nginx_1.

docker.png

 

Step 6.  Start Using YANG Suite

https://localhost:8443

If you get a certificate error, then accept the risk.  (Firefox shown.)

Click Advanced

risk.png

Click Accept Risk and Continue

cert.png

Accept the Cisco YANG Suite User Agreement (not shown).

Log into YANG Suite.  If you didn't change the default username/password in docker-compose.yml, then use admin/superuser.

To learn how to use YANG Suite,

 

Appendix.  How to determine if a port is in use

Before installing YANG Suite, you can determine if port 80 and 443 are already in use and what process is using them.

In the example below, port 80 is being used by PID 4. 

PS C:\yang\yangsuite> netstat -aon | Select-String LISTENING | Select-String :80
  TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       4
  TCP    [::]:80                [::]:0                 LISTENING       4

PS C:\yang\yangsuite> netstat -aon | Select-String LISTENING | Select-String :443

PS C:\yang\yangsuite
 

 Task Manager shows that PID 4 is the System process.task.png

 

2 REPLIES 2
clogsdon
Cisco Employee

In my article above, I did point to another thread with related tips, YANG Suite docker install on Windows 10.

This one post is particularly important if you haven't used Docker Desktop for Windows before.
https://community.cisco.com/t5/yang-tools/yang-suite-docker-install-on-windows-10/m-p/4298435/highlight/true#M1935

 

 

 

 

 

miott
Cisco Employee

Chuck,

Referring to the section about using dos2unix to get rid of CRLF.  Git for Windows install has 3 options relating to cloning repositories.

  1. When cloning, convert all text files to CRLF and commit changed files retaining the CRLF.
  2. When cloning, convert all text files to CRLF and commit changed files back to LF.
  3. When cloning and committing, leave files "as-is".

If you change the Git clone settings to "as-is", you do not have to run the dos2unix converter.

Content for Community-Ad