Docker insecure registries issue on Windows Server 2016

Asif Memon 1 Reputation point

This is my daemon.json at C:\ProgramData\docker\config, it did not exist originally but I created manually and copied contents from my Windows 10 pro config file.

  "allow-nondistributable-artifacts": [
  "experimental": true,
  "insecure-registries": [
    " myregistry:5000"
  "hosts": [

I am pulling a pre-build image from the registry but keep getting the error.

Pulling myContainer (myregistry:5000/mycontainer:v1)...
ERROR: Get https://myregistry:5000/v2/: http: server gave HTTP response to HTTPS client

I even tried setting insecure registries from command line flag

PS D:\workDir> dockerd --insecure-registry "myregistry:5000"
unable to configure the Docker daemon with file C:\ProgramData\docker\config\daemon.json: the following directives are specified both as a flag and in the configuration file: insecure-registries: (from flag: [myregistry:5000], from file: [myregistry:5000])

The registry server is Windows Server 2019
The same settings work fine on my Windows 10 pro machine. Only difference is that I have Docker Desktop installed on the Windows 10 machine. I am pretty new to Docker, so if I missed any info please let me know and I will edit my post and include it.

Edit: I am using also creating and using a context

docker context create  mycontext--docker "host=tcp://myregistry:2375"
docker context use mycontext
Microsoft Technologies based on the .NET software framework.
3,150 questions
Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,312 questions
{count} votes