Docker Community Forums

Share and learn in the Docker community.

Data traslation issue when sending JSON out from server running inside container

We are trying to host our server application inside a Docker for Windows Container - this server implements a Web Socket server written using Microsoft HTTP Server API.
We use clients running on Windows 10 to connect to the Web Socket server using .NET Framework.
We transmit data as JSON from the server to the client.
Issue we are experiencing is that the data does not always come in as sent from the server side - sometimes we find some strings are repeating and at other times we find that the data that should be chars contains null bytes - this breaks our JSON deserialization and stops any further processing.
At other times the same data is received properly.
We need help in tracing out where the data corruption is occurring

We are using the following docker image: 4.7.2-windowsservercore-ltsc2019

Might be mismatching locale of client and server? What is your config?

Hello, thanks for looking into this. Here is the container config:

{
	"StreamConfig": {},
	"State": {
		"Running": true,
		"Paused": false,
		"Restarting": false,
		"OOMKilled": false,
		"RemovalInProgress": false,
		"Dead": false,
		"Pid": 1360,
		"ExitCode": 0,
		"Error": "",
		"StartedAt": "2021-07-09T13:36:08.7777024Z",
		"FinishedAt": "2021-07-09T09:35:47.2493086-04:00",
		"Health": null
	},
	"ID": "c741b215b48d2eeae593322ed816ffbd7c4eff0c2eb5a9f05a446340dc9803d2",
	"Created": "2021-07-09T12:05:14.95797Z",
	"Managed": false,
	"Path": "cmd /S /C powershell Start-Service 'name' ; while((Get-Service name).Status -eq 'Running'){start-sleep -s 20}",
	"Args": [
		"ping",
		"-t",
		"localhost"
	],
	"Config": {
		"Hostname": "c741b215b48d",
		"Domainname": "",
		"User": "",
		"AttachStdin": false,
		"AttachStdout": false,
		"AttachStderr": false,
		"ExposedPorts": {
			"1200/tcp": {},
			"1433/tcp": {},
			"20940/tcp": {},
			"21971/tcp": {},
			"24755/tcp": {},
			"3655/tcp": {}
		},
		"Tty": false,
		"OpenStdin": false,
		"StdinOnce": false,
		"Env": [
			"COMPLUS_NGenProtectedProcess_FeatureEnabled=0",
			"sql_express_download_url=https://go.microsoft.com/fwlink/?linkid=829176",
			"sa_password=_",
			"attach_dbs=[]",
			"ACCEPT_EULA=Y",
			"sa_password_path=C:\\ProgramData\\Docker\\secrets\\sa-password"
		],
		"Cmd": [
			"ping",
			"-t",
			"localhost"
		],
		"ArgsEscaped": true,
		"Image": "a09567a9fcd4",
		"Volumes": null,
		"WorkingDir": "C:\\Folder",
		"Entrypoint": [
			"cmd /S /C powershell Start-Service 'name' ; while((Get-Service name).Status -eq 'Running'){start-sleep -s 20}"
		],
		"OnBuild": null,
		"Labels": {
			"CreationDate": "2021-06-23T10:38:37",
			"WebConsolePort": "24755",
			"WebSocketPort": "21971"
		}
	},
	"Image": "sha256:a09567a9fcd47d19b5ff0535a7b8fe3117a46e513ab685693f516bfa08f66c6b",
	"NetworkSettings": {
		"Bridge": "",
		"SandboxID": "c741b215b48d2eeae593322ed816ffbd7c4eff0c2eb5a9f05a446340dc9803d2",
		"HairpinMode": false,
		"LinkLocalIPv6Address": "",
		"LinkLocalIPv6PrefixLen": 0,
		"Networks": {
			"nat": {
				"IPAMConfig": null,
				"Links": null,
				"Aliases": null,
				"NetworkID": "87186588df7373a9a7b8dc44a7b7dfc0c13d6d6ed22bc5fb08853edb57102a0b",
				"EndpointID": "e4afb858b45a7983b3c40e2fdf1694fe409bd24ceb84e9e6f0c2a10ffe945be8",
				"Gateway": "172.30.48.1",
				"IPAddress": "172.30.54.156",
				"IPPrefixLen": 16,
				"IPv6Gateway": "",
				"GlobalIPv6Address": "",
				"GlobalIPv6PrefixLen": 0,
				"MacAddress": "00:15:5d:8b:86:f9",
				"DriverOpts": null,
				"IPAMOperational": false
			}
		},
		"Service": null,
		"Ports": {
			"1200/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "1064"
				}
			],
			"1433/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "1061"
				}
			],
			"20940/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "20940"
				}
			],
			"21971/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "21971"
				}
			],
			"24755/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "24755"
				}
			],
			"3655/tcp": null
		},
		"SandboxKey": "c741b215b48d2eeae593322ed816ffbd7c4eff0c2eb5a9f05a446340dc9803d2",
		"SecondaryIPAddresses": null,
		"SecondaryIPv6Addresses": null,
		"IsAnonymousEndpoint": true,
		"HasSwarmEndpoint": false
	},
	"LogPath": "C:\\ProgramData\\Docker\\containers\\c741b215b48d2eeae593322ed816ffbd7c4eff0c2eb5a9f05a446340dc9803d2\\c741b215b48d2eeae593322ed816ffbd7c4eff0c2eb5a9f05a446340dc9803d2-json.log",
	"Name": "/optimistic_spence",
	"Driver": "windowsfilter",
	"OS": "windows",
	"MountLabel": "",
	"ProcessLabel": "",
	"RestartCount": 0,
	"HasBeenStartedBefore": true,
	"HasBeenManuallyStopped": false,
	"MountPoints": {},
	"SecretReferences": null,
	"ConfigReferences": null,
	"AppArmorProfile": "",
	"HostnamePath": "",
	"HostsPath": "",
	"ShmPath": "",
	"ResolvConfPath": "",
	"SeccompProfile": "",
	"NoNewPrivileges": false,
	"LocalLogCacheMeta": {
		"HaveNotifyEnabled": false
	}
}

Update: wrapped the output of docker inspect into a code block.

Host Config:

{
	"Binds": null,
	"ContainerIDFile": "",
	"LogConfig": {
		"Type": "json-file",
		"Config": {}
	},
	"NetworkMode": "default",
	"PortBindings": {
		"1200/tcp": [
			{
				"HostIp": "",
				"HostPort": "1064"
			}
		],
		"1433/tcp": [
			{
				"HostIp": "",
				"HostPort": "1061"
			}
		],
		"20940/tcp": [
			{
				"HostIp": "",
				"HostPort": "20940"
			}
		],
		"21971/tcp": [
			{
				"HostIp": "",
				"HostPort": "21971"
			}
		],
		"24755/tcp": [
			{
				"HostIp": "",
				"HostPort": "24755"
			}
		]
	},
	"RestartPolicy": {
		"Name": "no",
		"MaximumRetryCount": 0
	},
	"AutoRemove": false,
	"VolumeDriver": "",
	"VolumesFrom": null,
	"CapAdd": null,
	"CapDrop": null,
	"CgroupnsMode": "",
	"Dns": [],
	"DnsOptions": [],
	"DnsSearch": [],
	"ExtraHosts": null,
	"GroupAdd": null,
	"IpcMode": "",
	"Cgroup": "",
	"Links": null,
	"OomScoreAdj": 0,
	"PidMode": "",
	"Privileged": false,
	"PublishAllPorts": false,
	"ReadonlyRootfs": false,
	"SecurityOpt": null,
	"UTSMode": "",
	"UsernsMode": "",
	"ShmSize": 0,
	"ConsoleSize": [
		50,
		120
	],
	"Isolation": "hyperv",
	"CpuShares": 0,
	"Memory": 8589934592,
	"NanoCpus": 0,
	"CgroupParent": "",
	"BlkioWeight": 0,
	"BlkioWeightDevice": [],
	"BlkioDeviceReadBps": null,
	"BlkioDeviceWriteBps": null,
	"BlkioDeviceReadIOps": null,
	"BlkioDeviceWriteIOps": null,
	"CpuPeriod": 0,
	"CpuQuota": 0,
	"CpuRealtimePeriod": 0,
	"CpuRealtimeRuntime": 0,
	"CpusetCpus": "",
	"CpusetMems": "",
	"Devices": [],
	"DeviceCgroupRules": null,
	"DeviceRequests": null,
	"KernelMemory": 0,
	"KernelMemoryTCP": 0,
	"MemoryReservation": 0,
	"MemorySwap": 0,
	"MemorySwappiness": null,
	"OomKillDisable": false,
	"PidsLimit": null,
	"Ulimits": null,
	"CpuCount": 0,
	"CpuPercent": 0,
	"IOMaximumIOps": 0,
	"IOMaximumBandwidth": 0,
	"MaskedPaths": null,
	"ReadonlyPaths": null
}

Update: wrapped the output with a code block.