mirror of
https://github.com/apple/container.git
synced 2026-08-27 02:46:31 +00:00
67 lines
3.9 KiB
Markdown
67 lines
3.9 KiB
Markdown
# Logs
|
|
|
|
View output from your containerized applications, VM boot logs, and the `container`
|
|
system's own logs.
|
|
|
|
## View container logs
|
|
|
|
The `container logs` command displays the output from your containerized application:
|
|
|
|
<pre>
|
|
% container run -d --name my-web-server --rm registry.example.com/fido/web-test:latest
|
|
my-web-server
|
|
% curl http://my-web-server.test
|
|
<!DOCTYPE html><html><head><title>Hello</title></head><body><h1>Hello, world!</h1></body></html>
|
|
% container logs my-web-server
|
|
192.168.64.1 - - [15/May/2025 03:00:03] "GET / HTTP/1.1" 200 -
|
|
%
|
|
</pre>
|
|
|
|
Use the `--boot` option to see the logs for the virtual machine boot and init process:
|
|
|
|
<pre>
|
|
% container logs --boot my-web-server
|
|
[ 0.098284] cacheinfo: Unable to detect cache hierarchy for CPU 0
|
|
[ 0.098466] random: crng init done
|
|
[ 0.099657] brd: module loaded
|
|
[ 0.100707] loop: module loaded
|
|
[ 0.100838] virtio_blk virtio2: 1/0/0 default/read/poll queues
|
|
[ 0.101051] virtio_blk virtio2: [vda] 1073741824 512-byte logical blocks (550 GB/512 GiB)
|
|
...
|
|
[ 0.127467] EXT4-fs (vda): mounted filesystem without journal. Quota mode: disabled.
|
|
[ 0.127525] VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
|
|
[ 0.127635] devtmpfs: mounted
|
|
[ 0.127773] Freeing unused kernel memory: 2816K
|
|
[ 0.143252] Run /sbin/vminitd as init process
|
|
2025-05-15T02:24:08+0000 info vminitd : [vminitd] vminitd booting...
|
|
2025-05-15T02:24:08+0000 info vminitd : [vminitd] serve vminitd api
|
|
2025-05-15T02:24:08+0000 debug vminitd : [vminitd] starting process supervisor
|
|
2025-05-15T02:24:08+0000 debug vminitd : port=1024 [vminitd] booting grpc server on vsock
|
|
...
|
|
2025-05-15T02:24:08+0000 debug vminitd : exits=[362: 0] pid=363 [vminitd] checking for exit of managed process
|
|
2025-05-15T02:24:08+0000 debug vminitd : [vminitd] waiting on process my-web-server
|
|
[ 1.122742] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
|
|
2025-05-15T02:24:39+0000 debug vminitd : sec=1747275879 usec=478412 [vminitd] setTime
|
|
%
|
|
</pre>
|
|
|
|
## View system logs
|
|
|
|
The `container system logs` command allows you to look at the log messages that `container` writes:
|
|
|
|
<pre>
|
|
% container system logs | tail -8
|
|
2025-06-02 16:46:11.560780-0700 0xf6dc5 Info 0x0 61684 0 container-apiserver: [com.apple.container:APIServer] Registering plugin [id=com.apple.container.container-runtime-linux.my-web-server]
|
|
2025-06-02 16:46:11.699095-0700 0xf6ea8 Info 0x0 61733 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting container-runtime-linux [uuid=my-web-server]
|
|
2025-06-02 16:46:11.699125-0700 0xf6ea8 Info 0x0 61733 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] configuring XPC server [uuid=my-web-server]
|
|
2025-06-02 16:46:11.700908-0700 0xf6ea8 Info 0x0 61733 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] starting XPC server [uuid=my-web-server]
|
|
2025-06-02 16:46:11.703028-0700 0xf6ea8 Info 0x0 61733 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `bootstrap` xpc handler [uuid=my-web-server]
|
|
2025-06-02 16:46:11.720836-0700 0xf6dc3 Info 0x0 61689 0 container-network-vmnet: [com.apple.container:NetworkVmnetHelper] allocated attachment [hostname=my-web-server.test.] [address=192.168.64.2/24] [gateway=192.168.64.1] [id=default]
|
|
2025-06-02 16:46:12.293193-0700 0xf6eaa Info 0x0 61733 0 container-runtime-linux: [com.apple.container:RuntimeLinuxHelper] `start` xpc handler [uuid=my-web-server]
|
|
2025-06-02 16:46:12.368723-0700 0xf6e93 Info 0x0 61684 0 container-apiserver: [com.apple.container:APIServer] Handling container my-web-server Start.
|
|
%
|
|
</pre>
|
|
|
|
See [bug report how-to](./bug-report-how-to.md) for gathering logs when filing an
|
|
issue.
|