Kontener samoczynnie się wyłącza

1

Dzień dobry,
mam uruchomiony kontener w PowerShellu za pomocą docker start Backend, a następnie docker attach Backend.
Na poniższym obrazku widać że sobie ładnie pracuje:
screenshot-20230804012743.png
Natomiast w ciągu niecałych 5 minut sam się wyłącza, niezależnie od tego czy kierowana jest do niego komunikacja z kontenera o nazwie Fronted.

screenshot-20230804013121.png
Dodam że to samo dzieje się z kontenerem o nazwie Fronted :(

Pozdrawiam,
Łukasz

2

Logi, zacznij od sprawdzenia logów z kontenera....
Exit code, czasami jest znaczący np. out of memory - 127 czy coś.

Bez tego to jak wróżenie z fusów...

0
0xmarcin napisał(a):

Logi, zacznij od sprawdzenia logów z kontenera....
Exit code, czasami jest znaczący np. out of memory - 127 czy coś.

Bez tego to jak wróżenie z fusów...

Sam kontener został utworzony za pomocą polecenia:
docker run -p 5000:80 --workdir /Fronted --name Fronted -it rejestr_image:1.0 dotnet "Rejestr.dll"
Teraz do uruchomienia obrazu użyłem poleceń:
docker start Fronted
a następnie:
dokcker attach Fronted
Jak przestało działać wykonałem polecenie:
docker logs Fronted i otrzymałem taki rezultat:

*warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory 'C:\Users\ContainerUser\AppData\Local\ASP.NET\DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Fronted*

Zawartość pliku Dockerfile
FROM asp_net_core:6.0
WORKDIR /Fronted
COPY /Fronted/ ./
WORKDIR /Backend
COPY /Backend/ ./

Następnie zmieniłem wygenerowaną nazwę obrazu na ..rejestr_wylegow"
Ostatnim krokiem było utworzenie kontenerów za pomocą dwóch poleceń:
docker run -p 5000:80--workdir /Backend --name Backend -it rejestr_wylegow:1.0 dotnet "WebAPI.dll"
oraz
docker run -p 5001:80--workdir /Fronted --name Fronted -it rejestr_wylegow:1.0 dotnet "Rejestr_Wylegow.dll"
na koniec wykonałem polecenie:
docker start Backend
docker start Fronted

0
  1. Bazowy image wydaje się podejrzany
  2. https://www.docker.com/blog/9-tips-for-containerizing-your-net-application/

Dodał bym CMD lub ENTRYPOINT do Dockerfile. Ciężko powiedzieć co to, na sieci jest dużo różnych powodów. Dodaj również try-catch na cały Main.

0
0xmarcin napisał(a):
  1. Bazowy image wydaje się podejrzany
  2. https://www.docker.com/blog/9-tips-for-containerizing-your-net-application/

Dodał bym CMD lub ENTRYPOINT do Dockerfile. Ciężko powiedzieć co to, na sieci jest dużo różnych powodów. Dodaj również try-catch na cały Main.

Tutaj wykonałem jeszcze polecenie docker inspect

[
{
"Id": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"Created": "2023-08-06T1823.3556101Z",
"Path": "dotnet",
"Args": [
"Rejestr Wylegow NET.dll"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 3221226505,
"Error": "",
"StartedAt": "2023-08-06T1825.282371Z",
"FinishedAt": "2023-08-06T2034.8905368+02:00"
},
"Image": "sha256:91df12e3ef2c952c980de97df47cd4ecced8d701b1d8dc521047152f93a1eafa",
"ResolvConfPath": "",
"HostnamePath": "",
"HostsPath": "",
"LogPath": "C:\ProgramData\docker\containers\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671-json.log",
"Name": "/Fronted",
"RestartCount": 0,
"Driver": "windowsfilter",
"Platform": "windows",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"5000/tcp": [
{
"HostIp": "",
"HostPort": "5001"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
30,
120
],
"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,
"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": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": null,
"ReadonlyPaths": null
},
"GraphDriver": {
"Data": {
"dir": "C:\ProgramData\docker\windowsfilter\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671"
},
"Name": "windowsfilter"
},
"Mounts": [],
"Config": {
"Hostname": "ab798dcd745b",
"Domainname": "",
"User": "ContainerUser",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"ASPNETCORE_URLS=",
"DOTNET_RUNNING_IN_CONTAINER=true",
"DOTNET_VERSION=6.0.20",
"ASPNET_VERSION=6.0.20",
"DOTNET_GENERATE_ASPNET_CERTIFICATE=false",
"DOTNET_NOLOGO=true",
"DOTNET_SDK_VERSION=6.0.412",
"DOTNET_USE_POLLING_FILE_WATCHER=true",
"NUGET_XMLDOC_MODE=skip",
"POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-NanoServer-ltsc2022"
],
"Cmd": [
"dotnet",
"Rejestr Wylegow NET.dll"
],
"Image": "obraz",
"Volumes": null,
"WorkingDir": "\Fronted",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"nat": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "9193ce732af79d244a4d1714052cca7a83ef4a0c355616297011dd6052f9a510",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]

0
virusek391 napisał(a):
0xmarcin napisał(a):
  1. Bazowy image wydaje się podejrzany
  2. https://www.docker.com/blog/9-tips-for-containerizing-your-net-application/

Dodał bym CMD lub ENTRYPOINT do Dockerfile. Ciężko powiedzieć co to, na sieci jest dużo różnych powodów. Dodaj również try-catch na cały Main.

Tutaj wykonałem jeszcze polecenie docker inspect

[
{
"Id": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"Created": "2023-08-06T1823.3556101Z",
"Path": "dotnet",
"Args": [
"Rejestr Wylegow NET.dll"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 3221226505,
"Error": "",
"StartedAt": "2023-08-06T1825.282371Z",
"FinishedAt": "2023-08-06T2034.8905368+02:00"
},
"Image": "sha256:91df12e3ef2c952c980de97df47cd4ecced8d701b1d8dc521047152f93a1eafa",
"ResolvConfPath": "",
"HostnamePath": "",
"HostsPath": "",
"LogPath": "C:\ProgramData\docker\containers\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671-json.log",
"Name": "/Fronted",
"RestartCount": 0,
"Driver": "windowsfilter",
"Platform": "windows",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"5000/tcp": [
{
"HostIp": "",
"HostPort": "5001"
}
]
},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
30,
120
],
"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,
"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": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": null,
"ReadonlyPaths": null
},
"GraphDriver": {
"Data": {
"dir": "C:\ProgramData\docker\windowsfilter\ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671"
},
"Name": "windowsfilter"
},
"Mounts": [],
"Config": {
"Hostname": "ab798dcd745b",
"Domainname": "",
"User": "ContainerUser",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5000/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [
"ASPNETCORE_URLS=",
"DOTNET_RUNNING_IN_CONTAINER=true",
"DOTNET_VERSION=6.0.20",
"ASPNET_VERSION=6.0.20",
"DOTNET_GENERATE_ASPNET_CERTIFICATE=false",
"DOTNET_NOLOGO=true",
"DOTNET_SDK_VERSION=6.0.412",
"DOTNET_USE_POLLING_FILE_WATCHER=true",
"NUGET_XMLDOC_MODE=skip",
"POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-NanoServer-ltsc2022"
],
"Cmd": [
"dotnet",
"Rejestr Wylegow NET.dll"
],
"Image": "obraz",
"Volumes": null,
"WorkingDir": "\Fronted",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"nat": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "9193ce732af79d244a4d1714052cca7a83ef4a0c355616297011dd6052f9a510",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]

Ok mam już błąd:
Nie można znaleźć opisu identyfikatora zdarzenia '11' w źródle 'docker'. Na komputerze lokalnym może nie być informacji rejestru lub plików DLL komunikatu niezbędnych do wyświetlenia komunikatu lub użytkownik może nie m
ieć wymaganych uprawnień dostępu. Poniższe informacje są częścią zdarzenia:'sending event', 'module=libcontainerd namespace=moby container=ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671 event=start even
t-info={ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671 ab798dcd745bc7626e151b0ec1edb49ad4ea39740f12095bb3ba866c27fa6671 1848 0 0001-01-01 0000 +0000 UTC <nil>}'

1
virusek391 napisał(a):
        "Pid": 0,
        "ExitCode": 3221226505,

I tu jest kod błędu, można go googlować, coś tam znajduje.

jeszcze możesz w wersji szesnastkowej: c0000409

1 użytkowników online, w tym zalogowanych: 0, gości: 1