Docker doesn’t output the logs from a container

Steps to reproduce the issue 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

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:

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:

The docker file

FROM  AS build

# 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

FROM AS runtime 
COPY --from=build /app/out ./
VOLUME ["/app/wwwroot"]
VOLUME ["/app/App_Data"]
ENTRYPOINT ["dotnet", "MQKJ.RaiseBaby.Web.Host.dll"]

Output of docker version

 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

  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
 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
  Task History Retention Limit: 5
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
  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:
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
  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
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Insecure Registries:
Registry Mirrors:
Live Restore Enabled: false

Source: StackOverflow