Docker doesn’t output the logs from a container

Steps to reproduce the issue

1.build docker image,and publish it
2.pull image,then run

docker run --name myapp -p 30010:80 -e ASPNETCORE_ENVIRONMENT=Production -v /home/gdll/host:/app/wwwroot/Files -v /etc/localtime:/etc/localtime:ro --restart=always -d hub.tencentyun.com/xxxx/xxxx

3.docker logs myapp

Expected behavior

Output logs.

Actual behavior

It’s nothing!

Additional information (e.g. issue happens only occasionally)

The docker logs is json-file.Help Me,Please! I have already crazy.

The dotnet info of container

Output of ‘dotnet –info’

It was not possible to find any installed .NET Core SDKs
  Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
      https://aka.ms/dotnet-download

Host (useful for support):
  Version: 3.1.0
  Commit:  157910edee

.NET Core SDKs installed:
  No SDKs were found.

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

The docker file

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster  AS build
WORKDIR /app

# copy csproj and restore as distinct layers
COPY ./aspnet-core/src/ api/src/
COPY ./aspnet-core/tools/ api/tools/
RUN dotnet restore ./api/src/MQKJ.RaiseBaby.Web.Host/MQKJ.RaiseBaby.Web.Host.csproj

# copy everything else and build app
RUN dotnet publish api/src/MQKJ.RaiseBaby.Web.Host/MQKJ.RaiseBaby.Web.Host.csproj -c Release -o out

#finally
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime 
WORKDIR /app
EXPOSE 80
COPY --from=build /app/out ./
VOLUME ["/app/wwwroot"]
VOLUME ["/app/App_Data"]
ENTRYPOINT ["dotnet", "MQKJ.RaiseBaby.Web.Host.dll"]

Output of docker version

Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:08:18 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:10:42 2018
  OS/Arch:          linux/amd64
  Experimental:     false

Output of docker info

Containers: 6
 Running: 6
 Paused: 0
 Stopped: 0
Images: 19
Server Version: 18.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: s54837jakzc0lel3r2rikpkex
 Is Manager: true
 ClusterID: r35n5ok1e4wfcu3mdo0hv7q4g
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
 Autolock Managers: false
 Root Rotation In Progress: false
 Node Address: xxx.xx.x.xx
 Manager Addresses:
  xxx.xx.x.xx:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-957.21.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.701GiB
Name: VM_0_14_centos
ID: WKV7:KHVQ:6BNP:JM3L:EY5V:A4LM:G7SI:CP4R:ACQ7:VLFW:ETOY:QEKK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Registry Mirrors:
 https://xxx.mirror.aliyuncs.com/
Live Restore Enabled: false

Source: StackOverflow