Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy-FileToBcContainer: Invalid JSON primitive #3442

Closed
cr998 opened this issue Mar 25, 2024 · 5 comments
Closed

Copy-FileToBcContainer: Invalid JSON primitive #3442

cr998 opened this issue Mar 25, 2024 · 5 comments

Comments

@cr998
Copy link

cr998 commented Mar 25, 2024

Describe the issue
When we i copy an DLL to container it throws an error related with "Not valid JSON"

Command

Copy-FileToBcContainer -containerName myFood -localPath .\******.dll -containerPath "C:\Program Files\Microsoft Dynamics NAV\210\Service\Add-ins\******.dll"

Full output of scripts

Copy-FileToBcContainer Telemetry Correlation Id: d739dd9f-9f31-403b-91fa-94e7d1d5610b
ConvertFrom-Json : Primitivo JSON no válido: failed.
En C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.11\ContainerInfo\Test-NavContainer.ps1: 34
Carácter: 45
+             $inspect = docker inspect $id | ConvertFrom-Json
+                                             ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

Screenshots
image

Additional context
I think that is related when using shared folder with container

@freddydk
Copy link
Contributor

Please try these commands and copy/paste the content of the commands here:

docker ps -a
docker inspect myFood

You can add | set-clipboard to the command to get the output directly into the clipboard and avoid having to mark and copy.

Thanks

@cr998
Copy link
Author

cr998 commented Mar 25, 2024

thanks for your reply, here are the output

docker ps -a

PS C:\windows\system32> docker ps -a

CONTAINER ID   IMAGE                                        COMMAND                  CREATED       STATUS                       PORTS                                                          NAMES
26d575ba2e01   mcr.microsoft.com/businesscentral:ltsc2022   "powershell -Command…"   2 hours ago   Up About an hour (healthy)   80/tcp, 443/tcp, 1433/tcp, 7045-7049/tcp, 7083/tcp, 8080/tcp   myFood

docker inspect myFood

PS C:\windows\system32> docker inspect myFood
[
    {
        "Id": "26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2",
        "Created": "2024-03-25T11:04:08.1309242Z",
        "Path": "powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; .\\Run\\start.ps1",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 26664,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2024-03-25T11:30:07.7768658Z",
            "FinishedAt": "2024-03-25T12:29:49.8402369+01:00",
            "Health": {
                "Status": "healthy",
                "FailingStreak": 0,
                "Log": [
                    {
                        "Start": "2024-03-25T13:44:37.3903301+01:00",
                        "End": "2024-03-25T13:44:37.7025255+01:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2024-03-25T13:45:07.7148528+01:00",
                        "End": "2024-03-25T13:45:08.0177383+01:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2024-03-25T13:45:38.0272166+01:00",
                        "End": "2024-03-25T13:45:38.3483824+01:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2024-03-25T13:46:08.3541324+01:00",
                        "End": "2024-03-25T13:46:08.7372286+01:00",
                        "ExitCode": 0,
                        "Output": ""
                    },
                    {
                        "Start": "2024-03-25T13:46:38.7478296+01:00",
                        "End": "2024-03-25T13:46:39.1751357+01:00",
                        "ExitCode": 0,
                        "Output": ""
                    }
                ]
            }
        },
        "Image": "sha256:c4cd601a3c1b2d716b7eb8270a90a1355e58a2b9a18e10ed2e2e84a5f8108ed0",
        "ResolvConfPath": "",
        "HostnamePath": "",
        "HostsPath": "",
        "LogPath": "C:\\ProgramData\\Docker\\containers\\26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2\\26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2-json.log",
        "Name": "/myFood",
        "RestartCount": 0,
        "Driver": "windowsfilter",
        "Platform": "windows",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [
                "c:\\bcartifacts.cache:c:\\dl",
                "C:\\ProgramData\\BcContainerHelper:C:\\ProgramData\\BcContainerHelper",
                "C:\\ProgramData\\BcContainerHelper\\Extensions\\myFood\\my:C:\\Run\\my",
                "c:\\windows\\system32\\drivers\\etc:C:\\driversetc"
            ],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "ConsoleSize": [
                0,
                0
            ],
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "",
            "Dns": [
                "8.8.8.8",
                "8.8.4.4"
            ],
            "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,
            "Isolation": "process",
            "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,
            "MaskedPaths": null,
            "ReadonlyPaths": null
        },
        "GraphDriver": {
            "Data": {
                "dir": "C:\\ProgramData\\Docker\\windowsfilter\\26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2"
            },
            "Name": "windowsfilter"
        },
        "Mounts": [
            {
                "Type": "bind",
                "Source": "c:\\bcartifacts.cache",
                "Destination": "c:\\dl",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "c:\\programdata\\bccontainerhelper",
                "Destination": "c:\\programdata\\bccontainerhelper",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "c:\\programdata\\bccontainerhelper\\extensions\\myfood\\my",
                "Destination": "c:\\run\\my",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "bind",
                "Source": "c:\\windows\\system32\\drivers\\etc",
                "Destination": "c:\\driversetc",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "myFood",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "1433/tcp": {},
                "443/tcp": {},
                "7045/tcp": {},
                "7046/tcp": {},
                "7047/tcp": {},
                "7048/tcp": {},
                "7049/tcp": {},
                "7083/tcp": {},
                "80/tcp": {},
                "8080/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "isBcSandbox=N",
                "auth=NavUserPassword",
                "databaseServer=",
                "filesOnly=False",
                "useSSL=N",
                "locale=es-ES",
                "accept_eula=Y",
                "accept_outdated=Y",
                "username=active1",
                "ExitOnError=N",
                "databaseInstance=",
                "passwordKeyFile=c:\\run\\my\\aes.key",
                "artifactUrl=https://bcartifacts.azureedge.net/onprem/21.17.63680.0/es",
                "bakfile=C:\\ProgramData\\BcContainerHelper\\Extensions\\myFood\\database.bak",
                "licenseFile=c:\\run\\my\\license.bclicense",
                "enableApiServices=Y",
                "securePassword=**********************************************************************************",
                "removePasswordKeyFile=Y",
                "DOTNET_RUNNING_IN_CONTAINER=true",
                "COMPLUS_RUNNING_IN_CONTAINER=1",
                "COMPLUS_NGenProtectedProcess_FeatureEnabled=0",
                "only24=False"
            ],
            "Cmd": [
                "powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; .\\Run\\start.ps1"
            ],
            "Healthcheck": {
                "Test": [
                    "CMD",
                    "powershell",
                    ".\\Run\\HealthCheck.ps1"
                ],
                "Interval": 30000000000,
                "Timeout": 10000000000
            },
            "ArgsEscaped": true,
            "Image": "mcr.microsoft.com/businesscentral:ltsc2022",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "country": "es",
                "created": "202403131353",
                "eula": "https://go.microsoft.com/fwlink/?linkid=861843",
                "maintainer": "Dynamics SMB",
                "nav": "",
                "osversion": "10.0.20348.2340",
                "platform": "21.0.63661.0",
                "tag": "1.0.2.17",
                "version": "21.17.63680.0"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2",
            "SandboxKey": "26d575ba2e01b1f4fc1ff8df8f5fd835e5fa1ba520bf0c0211ae8e432236d1a2",
            "Ports": {
                "1433/tcp": null,
                "443/tcp": null,
                "7045/tcp": null,
                "7046/tcp": null,
                "7047/tcp": null,
                "7048/tcp": null,
                "7049/tcp": null,
                "7083/tcp": null,
                "80/tcp": null,
                "8080/tcp": null
            },
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "nat": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "MacAddress": "00:15:5d:d4:25:ef",
                    "NetworkID": "09f53992e4e736fc19d37e178389b7185e712d417d141e79a0ddd0c0846b93cb",
                    "EndpointID": "e95b2e15c71ae3d15addc80fe00c43b2866590f89f7b1accd387313f5f8f47d5",
                    "Gateway": "172.19.208.1",
                    "IPAddress": "172.19.214.215",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "DriverOpts": null,
                    "DNSNames": null
                }
            }
        }
    }
]

@freddydk
Copy link
Contributor

freddydk commented Mar 25, 2024

That looks like totally fine json
If you use

$inspect = docker inspect myFood | ConvertFrom-Json

Does that then throw an error?

@cr998
Copy link
Author

cr998 commented Mar 25, 2024

I did run docker inspect myFood anothe time and i can saw an unexpetcted line at the top of the output, it be related with #docker/for-win#13891, it looks like an error of docker rather BcContainerHelper.

image

Thansk for your time and your help

@freddydk
Copy link
Contributor

Which is fixed in Docker Desktop 4.28.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants