How to use mapping volumes: host (W10)->container(Linux)?

My host is Windows 10. I run docker

docker run -p 60000:60000 -v //C/Utils/Opserver-main/Config:/app/Config/ --rm -it $(docker build -q .)

It starts but in docker I do see the /app/Config is empty.

Then I run using this command:

docker run -p 60000:60000 --mount type=bind,src=C:\Utils\Opserver-main\Config,target=/app/Config --rm -it $(docker build -q .)

it works very fast and docker even does not start without any messages

What is the reason? How to fix it?

Docker is already runing. You are talking about containers.

You can read about path conversation here:
https://docs.docker.com/desktop/troubleshoot-and-support/troubleshoot/topics/#path-conversion-errors-on-windows

In the first case, I guess you should use only one slasg at the beginning, not two. Then it would possibly fail as the second. Why, I don’t know. likely becuse occures even if it is not shown, but you also remove the container. Try this:

docker run -p 60000:60000 --mount type=bind,src=C:\Utils\Opserver-main\Config,target=/app/Config  -it --name test $(docker build -q .)

And chek the container logs

docker logs test

But the best if you just don’t use such a complicated command until you make sure you containers work. I would use a simpler one even then.

docker build . -t localhost/test
docker run -p 60000:60000 --mount type=bind,src=C:\Utils\Opserver-main\Config,target=/app/Config  -it --name test localhost/test

and then check the logs. You can also try removing -it as an interactive terminal can also break containers in some cases.

Thanx. I have used your latest commands. The image was built ok. But when I run it runs very fast without any messages, and container did not appear in Docker desktop. Also, docker logs test shows nothing.
Something strange.
Also, in the Docker Desktop logs is empty, only the Inspect

{
	"Id": "dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5",
	"Created": "2025-04-29T08:56:02.230100982Z",
	"Path": "dotnet",
	"Args": [
		"Opserver.Web.dll"
	],
	"State": {
		"Status": "exited",
		"Running": false,
		"Paused": false,
		"Restarting": false,
		"OOMKilled": false,
		"Dead": false,
		"Pid": 0,
		"ExitCode": 1,
		"Error": "",
		"StartedAt": "2025-04-29T08:56:19.866247389Z",
		"FinishedAt": "2025-04-29T08:56:20.111303995Z"
	},
	"Image": "sha256:d71b7ae49a57750fc351156b91c7defa59e56d07d2b0de0a90f53e2d58a6df00",
	"ResolvConfPath": "/var/lib/docker/containers/dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5/resolv.conf",
	"HostnamePath": "/var/lib/docker/containers/dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5/hostname",
	"HostsPath": "/var/lib/docker/containers/dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5/hosts",
	"LogPath": "/var/lib/docker/containers/dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5/dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5-json.log",
	"Name": "/test",
	"RestartCount": 0,
	"Driver": "overlay2",
	"Platform": "linux",
	"MountLabel": "",
	"ProcessLabel": "",
	"AppArmorProfile": "",
	"ExecIDs": null,
	"HostConfig": {
		"Binds": null,
		"ContainerIDFile": "",
		"LogConfig": {
			"Type": "json-file",
			"Config": {}
		},
		"NetworkMode": "bridge",
		"PortBindings": {
			"60000/tcp": [
				{
					"HostIp": "",
					"HostPort": "60000"
				}
			]
		},
		"RestartPolicy": {
			"Name": "no",
			"MaximumRetryCount": 0
		},
		"AutoRemove": false,
		"VolumeDriver": "",
		"VolumesFrom": null,
		"ConsoleSize": [
			29,
			121
		],
		"CapAdd": null,
		"CapDrop": null,
		"CgroupnsMode": "host",
		"Dns": [],
		"DnsOptions": [],
		"DnsSearch": [],
		"ExtraHosts": null,
		"GroupAdd": null,
		"IpcMode": "private",
		"Cgroup": "",
		"Links": null,
		"OomScoreAdj": 0,
		"PidMode": "",
		"Privileged": false,
		"PublishAllPorts": false,
		"ReadonlyRootfs": false,
		"SecurityOpt": null,
		"UTSMode": "",
		"UsernsMode": "",
		"ShmSize": 67108864,
		"Runtime": "runc",
		"Isolation": "",
		"CpuShares": 0,
		"Memory": 0,
		"NanoCpus": 0,
		"CgroupParent": "",
		"BlkioWeight": 0,
		"BlkioWeightDevice": [],
		"BlkioDeviceReadBps": [],
		"BlkioDeviceWriteBps": [],
		"BlkioDeviceReadIOps": [],
		"BlkioDeviceWriteIOps": [],
		"CpuPeriod": 0,
		"CpuQuota": 0,
		"CpuRealtimePeriod": 0,
		"CpuRealtimeRuntime": 0,
		"CpusetCpus": "",
		"CpusetMems": "",
		"Devices": [],
		"DeviceCgroupRules": null,
		"DeviceRequests": null,
		"MemoryReservation": 0,
		"MemorySwap": 0,
		"MemorySwappiness": null,
		"OomKillDisable": false,
		"PidsLimit": null,
		"Ulimits": [],
		"CpuCount": 0,
		"CpuPercent": 0,
		"IOMaximumIOps": 0,
		"IOMaximumBandwidth": 0,
		"Mounts": [
			{
				"Type": "bind",
				"Source": "C:\\Utils\\Opserver-main\\Config",
				"Target": "/app/Config"
			}
		],
		"MaskedPaths": [
			"/proc/asound",
			"/proc/acpi",
			"/proc/interrupts",
			"/proc/kcore",
			"/proc/keys",
			"/proc/latency_stats",
			"/proc/timer_list",
			"/proc/timer_stats",
			"/proc/sched_debug",
			"/proc/scsi",
			"/sys/firmware",
			"/sys/devices/virtual/powercap"
		],
		"ReadonlyPaths": [
			"/proc/bus",
			"/proc/fs",
			"/proc/irq",
			"/proc/sys",
			"/proc/sysrq-trigger"
		]
	},
	"GraphDriver": {
		"Data": {
			"ID": "dbaddce62c0008fa15243cf0c2c10ba1d6e73cf8307f4c968e54f5ddad7555e5",
			"LowerDir": "/var/lib/docker/overlay2/f28461f668c75a92376f1006acf053a9ed847af9fc10d7a446bd773399ca20f3-init/diff:/var/lib/docker/overlay2/ww8bkz9s49bzrvw7tgom096th/diff:/var/lib/docker/overlay2/yl3uvjjmgupsomal7xz6sn7yf/diff:/var/lib/docker/overlay2/b50d271f7c00babe829729951c6674b80859e5342b6c75e6b5cbdd3a1c74dc33/diff:/var/lib/docker/overlay2/8697d4685dca89f541df2b0668a894ce14a7c5bba254ea4551ceedd8b367833f/diff:/var/lib/docker/overlay2/5f55df27f6e18fd7bd2f98b3036c581f564537c3b0aff112e0c84c5a3468eaf0/diff:/var/lib/docker/overlay2/48294881358c8344098d511d5f5fb07a7ec10ca45fe601f9fd2ba6e8fcd8d577/diff:/var/lib/docker/overlay2/1690da82dd6bfb6f7dc39e07fd66ef0fc329d9967db4b352683bc73fc5cf93a7/diff:/var/lib/docker/overlay2/7a0ff93c847b155d7229687e0e0c4afa31821843610cfe7d6b91d7d009637b1d/diff",
			"MergedDir": "/var/lib/docker/overlay2/f28461f668c75a92376f1006acf053a9ed847af9fc10d7a446bd773399ca20f3/merged",
			"UpperDir": "/var/lib/docker/overlay2/f28461f668c75a92376f1006acf053a9ed847af9fc10d7a446bd773399ca20f3/diff",
			"WorkDir": "/var/lib/docker/overlay2/f28461f668c75a92376f1006acf053a9ed847af9fc10d7a446bd773399ca20f3/work"
		},
		"Name": "overlay2"
	},
	"Mounts": [
		{
			"Type": "bind",
			"Source": "C:\\Utils\\Opserver-main\\Config",
			"Destination": "/app/Config",
			"Mode": "",
			"RW": true,
			"Propagation": "rprivate"
		}
	],
	"Config": {
		"Hostname": "dbaddce62c00",
		"Domainname": "",
		"User": "",
		"AttachStdin": false,
		"AttachStdout": true,
		"AttachStderr": true,
		"ExposedPorts": {
			"60000/tcp": {}
		},
		"Tty": false,
		"OpenStdin": false,
		"StdinOnce": false,
		"Env": [
			"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
			"APP_UID=1654",
			"ASPNETCORE_HTTP_PORTS=8080",
			"DOTNET_RUNNING_IN_CONTAINER=true",
			"DOTNET_VERSION=9.0.4",
			"ASPNET_VERSION=9.0.4"
		],
		"Cmd": null,
		"Image": "localhost/test",
		"Volumes": null,
		"WorkingDir": "/app",
		"Entrypoint": [
			"dotnet",
			"Opserver.Web.dll"
		],
		"OnBuild": null,
		"Labels": {}
	},
	"NetworkSettings": {
		"Bridge": "",
		"SandboxID": "",
		"SandboxKey": "",
		"Ports": {},
		"HairpinMode": false,
		"LinkLocalIPv6Address": "",
		"LinkLocalIPv6PrefixLen": 0,
		"SecondaryIPAddresses": null,
		"SecondaryIPv6Addresses": null,
		"EndpointID": "",
		"Gateway": "",
		"GlobalIPv6Address": "",
		"GlobalIPv6PrefixLen": 0,
		"IPAddress": "",
		"IPPrefixLen": 0,
		"IPv6Gateway": "",
		"MacAddress": "",
		"Networks": {
			"bridge": {
				"IPAMConfig": null,
				"Links": null,
				"Aliases": null,
				"MacAddress": "",
				"DriverOpts": null,
				"GwPriority": 0,
				"NetworkID": "282ce290681458d8c8a60dac70b50d72d80d452d0a99432d4d672c3231874d41",
				"EndpointID": "",
				"Gateway": "",
				"IPAddress": "",
				"IPPrefixLen": 0,
				"IPv6Gateway": "",
				"GlobalIPv6Address": "",
				"GlobalIPv6PrefixLen": 0,
				"DNSNames": null
			}
		}
	}
}

I have 2 inspect files from

  1. run container with volume
  2. run container without volume

Differences are in the section
1.

"Mounts": [
		{
			"Type": "bind",
			"Source": "/run/desktop/mnt/host/c/Utils/Opserver-main/Config",
			"Destination": "/app/Config",
			"Mode": "",
			"RW": true,
			"Propagation": "rprivate"
		}
	],
  1. "Mounts": [],

also
1.

"NetworkSettings": {
		"Bridge": "",
		"SandboxID": "",
		"SandboxKey": "",
		"Ports": {},
"NetworkSettings": {
		"Bridge": "",
		"SandboxID": "3093dab4e31e839cb33e00aa692702aa3e550cd15bfed3bb081d0aea40994cc2",
		"SandboxKey": "/var/run/docker/netns/3093dab4e31e",
		"Ports": {
			"60000/tcp": [
				{
					"HostIp": "0.0.0.0",
					"HostPort": "63000"
				}
			],
			"8080/tcp": null
		},

also
1.

"IPAddress": "",
		"IPPrefixLen": 0,
		"IPv6Gateway": "",
		"MacAddress": "",
		"Networks": {
			"bridge": {
				"IPAMConfig": null,
				"Links": null,
				"Aliases": null,
				"MacAddress": "",
				"DriverOpts": null,
				"GwPriority": 0,
				"NetworkID": "59131309336bcc43b4ce755dd69c09495363a31862b82a1d40d00080bd2db931",
				"EndpointID": "",
				"Gateway": "",
				"IPAddress": "",
				"IPPrefixLen": 0,
				"IPv6Gateway": "",
				"GlobalIPv6Address": "",
				"GlobalIPv6PrefixLen": 0,
				"DNSNames": null
			}
		}
	}
"IPAddress": "172.17.0.3",
		"IPPrefixLen": 16,
		"IPv6Gateway": "",
		"MacAddress": "be:ee:3c:db:bd:3b",
		"Networks": {
			"bridge": {
				"IPAMConfig": null,
				"Links": null,
				"Aliases": null,
				"MacAddress": "be:ee:3c:db:bd:3b",
				"DriverOpts": null,
				"GwPriority": 0,
				"NetworkID": "59131309336bcc43b4ce755dd69c09495363a31862b82a1d40d00080bd2db931",
				"EndpointID": "924e73f8a8f76e8bb05dedbfcde6b3f9d13a062ba140b5925ac1e4dd166e191f",
				"Gateway": "172.17.0.1",
				"IPAddress": "172.17.0.3",
				"IPPrefixLen": 16,
				"IPv6Gateway": "",
				"GlobalIPv6Address": "",
				"GlobalIPv6PrefixLen": 0,
				"DNSNames": null
			}
		}
	}

I added code blocks to your messages.


Please, format your post next time according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
echo "I am a code."
echo "An athletic one, and I wanna run."
```

I don’t understand your shared outputs as removing the bind mount definition would not change the network, so you must have done something else or I don’t understand what you shared.

You also shared two different sources

And I don’t understand why you got two different outputs. What diy ou execute exactly?

Regarding the missing error message, this is what you run in the container

So basically:

dotnet Opserver.Web.dll

Why that doesn’t return any error message, I don’t know, but I assume you would get the same if you tried running it in an interactive container:

docker run -it --rm --name testinteractive entrypoint "" localhost/test sh

and then

dotnet Opserver.Web.dll

Maybe it logs into a file if the image was not properly configured to run in a container in which case you would send error messages to the standard error stream.