02-24-2021 02:13 PM - edited 06-26-2023 09:25 AM
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.
Prereqs for my procedure
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.
|
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. |
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. |
|
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.
My Environment
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.
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
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"
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>
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.
If you get a certificate error, then accept the risk. (Firefox shown.)
Click Advanced
Click Accept Risk and Continue
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,
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.
02-26-2021 11:04 AM - edited 02-26-2021 11:04 AM
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
03-08-2021 09:18 AM
Chuck,
Referring to the section about using dos2unix to get rid of CRLF. Git for Windows install has 3 options relating to cloning repositories.
If you change the Git clone settings to "as-is", you do not have to run the dos2unix converter.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide