2021-08-23 13:14:53 +00:00
//go:build !windows
2016-11-11 16:02:23 +00:00
2018-02-05 21:05:59 +00:00
package daemon // import "github.com/docker/docker/daemon"
2016-11-11 16:02:23 +00:00
import (
2017-11-03 00:21:18 +00:00
"context"
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
"encoding/json"
2018-07-19 11:45:32 +00:00
"fmt"
2023-06-12 11:44:30 +00:00
"os"
2016-11-11 16:02:23 +00:00
"os/exec"
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
"path/filepath"
2016-11-11 16:02:23 +00:00
"strings"
2022-08-31 21:24:22 +00:00
v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
2023-09-13 15:41:45 +00:00
"github.com/containerd/log"
2016-11-11 16:02:23 +00:00
"github.com/docker/docker/api/types"
2019-03-15 03:44:18 +00:00
containertypes "github.com/docker/docker/api/types/container"
2023-07-03 11:14:14 +00:00
"github.com/docker/docker/api/types/system"
2022-08-17 21:13:49 +00:00
"github.com/docker/docker/daemon/config"
2023-09-10 00:05:05 +00:00
"github.com/docker/docker/errdefs"
2023-01-03 12:08:40 +00:00
"github.com/docker/docker/pkg/rootless"
2016-11-11 16:02:23 +00:00
"github.com/docker/docker/pkg/sysinfo"
2017-03-29 11:44:14 +00:00
"github.com/pkg/errors"
2023-06-12 11:44:30 +00:00
rkclient "github.com/rootless-containers/rootlesskit/pkg/api/client"
2016-11-11 16:02:23 +00:00
)
2018-07-13 11:14:45 +00:00
// fillPlatformInfo fills the platform related info.
2023-09-10 00:05:05 +00:00
func ( daemon * Daemon ) fillPlatformInfo ( ctx context . Context , v * system . Info , sysInfo * sysinfo . SysInfo , cfg * configStore ) error {
2022-08-31 21:24:22 +00:00
v . CgroupDriver = cgroupDriver ( & cfg . Config )
2020-03-10 12:09:25 +00:00
v . CgroupVersion = "1"
if sysInfo . CgroupUnified {
v . CgroupVersion = "2"
}
2021-03-16 07:17:22 +00:00
if v . CgroupDriver != cgroupNoneDriver {
v . MemoryLimit = sysInfo . MemoryLimit
v . SwapLimit = sysInfo . SwapLimit
v . KernelMemory = sysInfo . KernelMemory
v . KernelMemoryTCP = sysInfo . KernelMemoryTCP
v . OomKillDisable = sysInfo . OomKillDisable
v . CPUCfsPeriod = sysInfo . CPUCfs
v . CPUCfsQuota = sysInfo . CPUCfs
v . CPUShares = sysInfo . CPUShares
v . CPUSet = sysInfo . Cpuset
v . PidsLimit = sysInfo . PidsLimit
}
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
v . Runtimes = make ( map [ string ] system . RuntimeWithStatus )
2022-08-31 21:24:22 +00:00
for n , p := range stockRuntimes ( ) {
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
v . Runtimes [ n ] = system . RuntimeWithStatus {
Runtime : system . Runtime {
Path : p ,
} ,
Status : daemon . runtimeStatus ( ctx , cfg , n ) ,
}
2022-08-31 21:24:22 +00:00
}
for n , r := range cfg . Config . Runtimes {
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
v . Runtimes [ n ] = system . RuntimeWithStatus {
Runtime : system . Runtime {
Path : r . Path ,
Args : append ( [ ] string ( nil ) , r . Args ... ) ,
} ,
Status : daemon . runtimeStatus ( ctx , cfg , n ) ,
2022-08-31 20:12:30 +00:00
}
}
2022-08-31 21:24:22 +00:00
v . DefaultRuntime = cfg . Runtimes . Default
2021-08-23 11:19:31 +00:00
v . RuncCommit . ID = "N/A"
v . ContainerdCommit . ID = "N/A"
v . InitCommit . ID = "N/A"
2016-11-11 16:02:23 +00:00
2023-09-10 00:05:05 +00:00
if err := populateRuncCommit ( & v . RuncCommit , cfg ) ; err != nil {
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to retrieve default runtime version" )
2016-11-11 16:02:23 +00:00
}
2023-09-10 00:05:05 +00:00
if err := daemon . populateContainerdCommit ( ctx , & v . ContainerdCommit ) ; err != nil {
return err
2017-09-22 13:52:41 +00:00
}
2023-09-10 00:05:05 +00:00
if err := daemon . populateInitCommit ( ctx , v , cfg ) ; err != nil {
return err
2016-11-11 16:02:23 +00:00
}
2018-07-19 11:45:32 +00:00
2021-08-23 11:19:31 +00:00
// Set expected and actual commits to the same value to prevent the client
// showing that the version does not match the "expected" version/commit.
2020-03-10 12:09:25 +00:00
if v . CgroupDriver == cgroupNoneDriver {
if v . CgroupVersion == "2" {
2020-06-26 08:57:03 +00:00
v . Warnings = append ( v . Warnings , "WARNING: Running in rootless-mode without cgroups. Systemd is required to enable cgroups in rootless-mode." )
2020-03-10 12:09:25 +00:00
} else {
2020-06-26 08:57:03 +00:00
v . Warnings = append ( v . Warnings , "WARNING: Running in rootless-mode without cgroups. To enable cgroups in rootless-mode, you need to boot the system in cgroup v2 mode." )
2020-03-10 12:09:25 +00:00
}
} else {
if ! v . MemoryLimit {
v . Warnings = append ( v . Warnings , "WARNING: No memory limit support" )
}
if ! v . SwapLimit {
v . Warnings = append ( v . Warnings , "WARNING: No swap limit support" )
}
2021-01-19 06:07:08 +00:00
if ! v . KernelMemoryTCP && v . CgroupVersion == "1" {
// kernel memory is not available for cgroup v2.
// Warning is not printed on cgroup v2, because there is no action user can take.
2020-03-10 12:09:25 +00:00
v . Warnings = append ( v . Warnings , "WARNING: No kernel memory TCP limit support" )
}
2021-01-19 06:07:08 +00:00
if ! v . OomKillDisable && v . CgroupVersion == "1" {
// oom kill disable is not available for cgroup v2.
// Warning is not printed on cgroup v2, because there is no action user can take.
2020-03-10 12:09:25 +00:00
v . Warnings = append ( v . Warnings , "WARNING: No oom kill disable support" )
}
if ! v . CPUCfsQuota {
v . Warnings = append ( v . Warnings , "WARNING: No cpu cfs quota support" )
}
if ! v . CPUCfsPeriod {
v . Warnings = append ( v . Warnings , "WARNING: No cpu cfs period support" )
}
if ! v . CPUShares {
v . Warnings = append ( v . Warnings , "WARNING: No cpu shares support" )
}
if ! v . CPUSet {
v . Warnings = append ( v . Warnings , "WARNING: No cpuset support" )
}
2020-06-08 15:16:01 +00:00
// TODO add fields for these options in types.Info
2021-01-19 06:07:08 +00:00
if ! sysInfo . BlkioWeight && v . CgroupVersion == "2" {
// blkio weight is not available on cgroup v1 since kernel 5.0.
// Warning is not printed on cgroup v1, because there is no action user can take.
// On cgroup v2, blkio weight is implemented using io.weight
2021-01-20 04:42:32 +00:00
v . Warnings = append ( v . Warnings , "WARNING: No io.weight support" )
2020-06-08 15:16:01 +00:00
}
2021-01-19 06:07:08 +00:00
if ! sysInfo . BlkioWeightDevice && v . CgroupVersion == "2" {
2021-01-20 04:42:32 +00:00
v . Warnings = append ( v . Warnings , "WARNING: No io.weight (per device) support" )
2020-06-08 15:16:01 +00:00
}
if ! sysInfo . BlkioReadBpsDevice {
2021-01-20 04:42:32 +00:00
if v . CgroupVersion == "2" {
v . Warnings = append ( v . Warnings , "WARNING: No io.max (rbps) support" )
} else {
v . Warnings = append ( v . Warnings , "WARNING: No blkio throttle.read_bps_device support" )
}
2020-06-08 15:16:01 +00:00
}
if ! sysInfo . BlkioWriteBpsDevice {
2021-01-20 04:42:32 +00:00
if v . CgroupVersion == "2" {
v . Warnings = append ( v . Warnings , "WARNING: No io.max (wbps) support" )
} else {
v . Warnings = append ( v . Warnings , "WARNING: No blkio throttle.write_bps_device support" )
}
2020-06-08 15:16:01 +00:00
}
if ! sysInfo . BlkioReadIOpsDevice {
2021-01-20 04:42:32 +00:00
if v . CgroupVersion == "2" {
v . Warnings = append ( v . Warnings , "WARNING: No io.max (riops) support" )
} else {
v . Warnings = append ( v . Warnings , "WARNING: No blkio throttle.read_iops_device support" )
}
2020-06-08 15:16:01 +00:00
}
if ! sysInfo . BlkioWriteIOpsDevice {
2021-01-20 04:42:32 +00:00
if v . CgroupVersion == "2" {
v . Warnings = append ( v . Warnings , "WARNING: No io.max (wiops) support" )
} else {
v . Warnings = append ( v . Warnings , "WARNING: No blkio throttle.write_iops_device support" )
}
2020-06-08 15:16:01 +00:00
}
2018-07-19 11:45:32 +00:00
}
if ! v . IPv4Forwarding {
v . Warnings = append ( v . Warnings , "WARNING: IPv4 forwarding is disabled" )
}
if ! v . BridgeNfIptables {
v . Warnings = append ( v . Warnings , "WARNING: bridge-nf-call-iptables is disabled" )
}
if ! v . BridgeNfIP6tables {
v . Warnings = append ( v . Warnings , "WARNING: bridge-nf-call-ip6tables is disabled" )
}
2023-09-10 00:05:05 +00:00
return nil
2018-07-19 11:45:32 +00:00
}
2023-09-10 00:05:05 +00:00
func ( daemon * Daemon ) fillPlatformVersion ( ctx context . Context , v * types . Version , cfg * configStore ) error {
if err := daemon . populateContainerdVersion ( ctx , v ) ; err != nil {
return err
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
}
2023-09-10 00:05:05 +00:00
if err := populateRuncVersion ( cfg , v ) ; err != nil {
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to retrieve default runtime version" )
}
if err := populateInitVersion ( ctx , cfg , v ) ; err != nil {
return err
}
if err := daemon . fillRootlessVersion ( ctx , v ) ; err != nil {
if errdefs . IsContext ( err ) {
return err
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
}
2023-09-10 00:05:05 +00:00
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to fill rootless version" )
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
}
2023-09-10 00:05:05 +00:00
return nil
}
2021-04-27 07:46:04 +00:00
2023-09-10 00:05:05 +00:00
func populateRuncCommit ( v * system . Commit , cfg * configStore ) error {
_ , _ , commit , err := parseDefaultRuntimeVersion ( & cfg . Runtimes )
if err != nil {
return err
}
v . ID = commit
v . Expected = commit
return nil
2021-04-27 07:46:04 +00:00
}
2023-09-10 00:05:05 +00:00
func ( daemon * Daemon ) populateInitCommit ( ctx context . Context , v * system . Info , cfg * configStore ) error {
v . InitBinary = cfg . GetInitPath ( )
initBinary , err := cfg . LookupInitPath ( )
if err != nil {
log . G ( ctx ) . WithError ( err ) . Warnf ( "Failed to find docker-init" )
return nil
}
rv , err := exec . CommandContext ( ctx , initBinary , "--version" ) . Output ( )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warnf ( "Failed to retrieve %s version" , initBinary )
return nil
}
_ , commit , err := parseInitVersion ( string ( rv ) )
if err != nil {
log . G ( ctx ) . WithError ( err ) . Warnf ( "failed to parse %s version" , initBinary )
return nil
}
v . InitCommit . ID = commit
v . InitCommit . Expected = v . InitCommit . ID
return nil
}
func ( daemon * Daemon ) fillRootlessVersion ( ctx context . Context , v * types . Version ) error {
2021-04-27 07:46:04 +00:00
if ! rootless . RunningWithRootlessKit ( ) {
2023-09-10 00:05:05 +00:00
return nil
2021-04-27 07:46:04 +00:00
}
2023-06-12 11:44:30 +00:00
rlc , err := getRootlessKitClient ( )
2021-04-27 07:46:04 +00:00
if err != nil {
2023-09-10 00:05:05 +00:00
return errors . Wrap ( err , "failed to create RootlessKit client" )
2021-04-27 07:46:04 +00:00
}
2023-09-10 00:05:05 +00:00
rlInfo , err := rlc . Info ( ctx )
2021-04-27 07:46:04 +00:00
if err != nil {
2023-09-10 00:05:05 +00:00
return errors . Wrap ( err , "failed to retrieve RootlessKit version" )
2021-04-27 07:46:04 +00:00
}
v . Components = append ( v . Components , types . ComponentVersion {
Name : "rootlesskit" ,
Version : rlInfo . Version ,
Details : map [ string ] string {
"ApiVersion" : rlInfo . APIVersion ,
"StateDir" : rlInfo . StateDir ,
"NetworkDriver" : rlInfo . NetworkDriver . Driver ,
"PortDriver" : rlInfo . PortDriver . Driver ,
} ,
} )
switch rlInfo . NetworkDriver . Driver {
case "slirp4netns" :
2023-09-10 00:05:05 +00:00
err = func ( ) error {
rv , err := exec . CommandContext ( ctx , "slirp4netns" , "--version" ) . Output ( )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to retrieve slirp4netns version" )
return nil
2021-04-27 07:46:04 +00:00
}
2023-09-10 00:05:05 +00:00
_ , ver , commit , err := parseRuntimeVersion ( string ( rv ) )
if err != nil {
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to parse slirp4netns version" )
return nil
}
v . Components = append ( v . Components , types . ComponentVersion {
Name : "slirp4netns" ,
Version : ver ,
Details : map [ string ] string {
"GitCommit" : commit ,
} ,
} )
return nil
} ( )
if err != nil {
return err
2021-04-27 07:46:04 +00:00
}
case "vpnkit" :
2023-09-10 00:05:05 +00:00
err = func ( ) error {
out , err := exec . CommandContext ( ctx , "vpnkit" , "--version" ) . Output ( )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to retrieve vpnkit version" )
return nil
}
2021-04-27 07:46:04 +00:00
v . Components = append ( v . Components , types . ComponentVersion {
Name : "vpnkit" ,
2023-09-10 00:05:05 +00:00
Version : strings . TrimSpace ( strings . TrimSpace ( string ( out ) ) ) ,
2021-04-27 07:46:04 +00:00
} )
2023-09-10 00:05:05 +00:00
return nil
} ( )
if err != nil {
return err
2021-04-27 07:46:04 +00:00
}
}
2023-09-10 00:05:05 +00:00
return nil
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
}
2023-06-12 11:44:30 +00:00
// getRootlessKitClient returns RootlessKit client
func getRootlessKitClient ( ) ( rkclient . Client , error ) {
stateDir := os . Getenv ( "ROOTLESSKIT_STATE_DIR" )
if stateDir == "" {
return nil , errors . New ( "environment variable `ROOTLESSKIT_STATE_DIR` is not set" )
}
apiSock := filepath . Join ( stateDir , "api.sock" )
return rkclient . New ( apiSock )
}
2023-07-03 11:14:14 +00:00
func fillDriverWarnings ( v * system . Info ) {
2018-07-19 11:45:32 +00:00
for _ , pair := range v . DriverStatus {
2023-05-09 17:52:30 +00:00
if pair [ 0 ] == "Extended file attributes" && pair [ 1 ] == "best-effort" {
msg := fmt . Sprintf ( "WARNING: %s: extended file attributes from container images " +
"will be silently discarded if the backing filesystem does not support them.\n" +
" CONTAINERS MAY MALFUNCTION IF EXTENDED ATTRIBUTES ARE MISSING.\n" +
" This is an UNSUPPORTABLE configuration for which no bug reports will be accepted.\n" , v . Driver )
2018-07-19 11:45:32 +00:00
v . Warnings = append ( v . Warnings , msg )
continue
}
}
}
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
// parseInitVersion parses a Tini version string, and extracts the "version"
// and "git commit" from the output.
//
// Output example from `docker-init --version`:
//
2022-07-08 16:27:07 +00:00
// tini version 0.18.0 - git.fec3683
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
func parseInitVersion ( v string ) ( version string , commit string , err error ) {
2019-10-16 01:33:48 +00:00
parts := strings . Split ( v , " - " )
2017-03-29 11:44:14 +00:00
if len ( parts ) >= 2 {
2019-10-16 01:33:48 +00:00
gitParts := strings . Split ( strings . TrimSpace ( parts [ 1 ] ) , "." )
2017-03-29 11:44:14 +00:00
if len ( gitParts ) == 2 && gitParts [ 0 ] == "git" {
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
commit = gitParts [ 1 ]
2017-03-29 11:44:14 +00:00
}
}
2019-10-16 01:33:48 +00:00
parts [ 0 ] = strings . TrimSpace ( parts [ 0 ] )
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
if strings . HasPrefix ( parts [ 0 ] , "tini version " ) {
version = strings . TrimPrefix ( parts [ 0 ] , "tini version " )
}
if version == "" && commit == "" {
err = errors . Errorf ( "unknown output format: %s" , v )
}
return version , commit , err
}
2019-09-15 15:15:27 +00:00
// parseRuntimeVersion parses the output of `[runtime] --version` and extracts the
// "name", "version" and "git commit" from the output.
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
//
// Output example from `runc --version`:
//
2022-07-08 16:27:07 +00:00
// runc version 1.0.0-rc5+dev
// commit: 69663f0bd4b60df09991c08812a60108003fa340
// spec: 1.0.0
2022-08-31 20:12:30 +00:00
func parseRuntimeVersion ( v string ) ( runtime , version , commit string , err error ) {
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
lines := strings . Split ( strings . TrimSpace ( v ) , "\n" )
for _ , line := range lines {
2019-09-17 00:13:01 +00:00
if strings . Contains ( line , "version" ) {
s := strings . Split ( line , "version" )
2019-09-15 15:15:27 +00:00
runtime = strings . TrimSpace ( s [ 0 ] )
2019-09-17 00:13:01 +00:00
version = strings . TrimSpace ( s [ len ( s ) - 1 ] )
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
continue
}
if strings . HasPrefix ( line , "commit:" ) {
commit = strings . TrimSpace ( strings . TrimPrefix ( line , "commit:" ) )
continue
}
2017-03-29 11:44:14 +00:00
}
Add containerd, runc, and docker-init versions to /version
This patch adds version information about the containerd,
runc, and docker-init components to the /version endpoint.
With this patch applied, running:
```
curl --unix-socket /var/run/docker.sock http://localhost/version | jq .
```
Will produce this response:
```json
{
"Platform": {
"Name": ""
},
"Components": [
{
"Name": "Engine",
"Version": "dev",
"Details": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00",
"Experimental": "false",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"KernelVersion": "4.9.93-linuxkit-aufs",
"MinAPIVersion": "1.12",
"Os": "linux"
}
},
{
"Name": "containerd",
"Version": "v1.1.4",
"Details": {
"GitCommit": "9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b"
}
},
{
"Name": "runc",
"Version": "1.0.0-rc5+dev",
"Details": {
"GitCommit": "a00bf0190895aa465a5fbed0268888e2c8ddfe85"
}
},
{
"Name": "docker-init",
"Version": "0.18.0",
"Details": {
"GitCommit": "fec3683"
}
}
],
"Version": "dev",
"ApiVersion": "1.40",
"MinAPIVersion": "1.12",
"GitCommit": "7d02782d2f",
"GoVersion": "go1.11.2",
"Os": "linux",
"Arch": "amd64",
"KernelVersion": "4.9.93-linuxkit-aufs",
"BuildTime": "2018-11-08T10:23:42.000000000+00:00"
}
```
When using a recent version of the CLI, that information is included in the
output of `docker version`:
```
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:46:51 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: dev
API version: 1.40 (minimum version 1.12)
Go version: go1.11.2
Git commit: 7d02782d2f
Built: Thu Nov 8 10:23:42 2018
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.1.4
GitCommit: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b
runc:
Version: 1.0.0-rc5+dev
GitCommit: a00bf0190895aa465a5fbed0268888e2c8ddfe85
docker-init:
Version: 0.18.0
GitCommit: fec3683
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-10-05 10:30:10 +00:00
if version == "" && commit == "" {
err = errors . Errorf ( "unknown output format: %s" , v )
2017-03-29 11:44:14 +00:00
}
2019-09-15 15:15:27 +00:00
return runtime , version , commit , err
2017-03-29 11:44:14 +00:00
}
2018-10-15 07:52:53 +00:00
2022-08-31 21:24:22 +00:00
func parseDefaultRuntimeVersion ( rts * runtimes ) ( runtime , version , commit string , err error ) {
shim , opts , err := rts . Get ( rts . Default )
if err != nil {
return "" , "" , "" , err
}
shimopts , ok := opts . ( * v2runcoptions . Options )
if ! ok {
return "" , "" , "" , fmt . Errorf ( "%s: retrieving version not supported" , shim )
}
rt := shimopts . BinaryName
if rt == "" {
rt = defaultRuntimeName
2022-08-31 20:12:30 +00:00
}
2022-08-31 21:24:22 +00:00
rv , err := exec . Command ( rt , "--version" ) . Output ( )
if err != nil {
return "" , "" , "" , fmt . Errorf ( "failed to retrieve %s version: %w" , rt , err )
}
runtime , version , commit , err = parseRuntimeVersion ( string ( rv ) )
if err != nil {
return "" , "" , "" , fmt . Errorf ( "failed to parse %s version: %w" , rt , err )
}
return runtime , version , commit , err
2022-08-31 20:12:30 +00:00
}
2022-08-17 21:13:49 +00:00
func cgroupNamespacesEnabled ( sysInfo * sysinfo . SysInfo , cfg * config . Config ) bool {
return sysInfo . CgroupNamespaces && containertypes . CgroupnsMode ( cfg . CgroupNamespaceMode ) . IsPrivate ( )
2019-03-15 03:44:18 +00:00
}
2019-02-28 08:12:55 +00:00
// Rootless returns true if daemon is running in rootless mode
2022-08-17 21:13:49 +00:00
func Rootless ( cfg * config . Config ) bool {
return cfg . Rootless
2018-10-15 07:52:53 +00:00
}
2023-04-13 11:27:59 +00:00
2022-08-17 21:13:49 +00:00
func noNewPrivileges ( cfg * config . Config ) bool {
return cfg . NoNewPrivileges
2023-04-13 11:27:59 +00:00
}
2023-09-10 00:05:05 +00:00
func ( daemon * Daemon ) populateContainerdCommit ( ctx context . Context , v * system . Commit ) error {
rv , err := daemon . containerd . Version ( ctx )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warnf ( "Failed to retrieve containerd version" )
return nil
}
v . ID = rv . Revision
v . Expected = rv . Revision
return nil
}
func ( daemon * Daemon ) populateContainerdVersion ( ctx context . Context , v * types . Version ) error {
rv , err := daemon . containerd . Version ( ctx )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to retrieve containerd version" )
return nil
}
v . Components = append ( v . Components , types . ComponentVersion {
Name : "containerd" ,
Version : rv . Version ,
Details : map [ string ] string {
"GitCommit" : rv . Revision ,
} ,
} )
return nil
}
func populateRuncVersion ( cfg * configStore , v * types . Version ) error {
_ , ver , commit , err := parseDefaultRuntimeVersion ( & cfg . Runtimes )
if err != nil {
return err
}
v . Components = append ( v . Components , types . ComponentVersion {
Name : cfg . Runtimes . Default ,
Version : ver ,
Details : map [ string ] string {
"GitCommit" : commit ,
} ,
} )
return nil
}
func populateInitVersion ( ctx context . Context , cfg * configStore , v * types . Version ) error {
initBinary , err := cfg . LookupInitPath ( )
if err != nil {
log . G ( ctx ) . WithError ( err ) . Warn ( "Failed to find docker-init" )
return nil
}
rv , err := exec . CommandContext ( ctx , initBinary , "--version" ) . Output ( )
if err != nil {
if errdefs . IsContext ( err ) {
return err
}
log . G ( ctx ) . WithError ( err ) . Warnf ( "Failed to retrieve %s version" , initBinary )
return nil
}
ver , commit , err := parseInitVersion ( string ( rv ) )
if err != nil {
log . G ( ctx ) . WithError ( err ) . Warnf ( "failed to parse %s version" , initBinary )
return nil
}
v . Components = append ( v . Components , types . ComponentVersion {
Name : filepath . Base ( initBinary ) ,
Version : ver ,
Details : map [ string ] string {
"GitCommit" : commit ,
} ,
} )
return nil
}
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
2023-10-15 14:51:11 +00:00
// ociRuntimeFeaturesKey is the "well-known" key used for including the
docker info: expose runtime features ("rro" mount mode, etc.)
Fix issue 46580
```console
$ curl -s --unix-socket /var/run/docker.sock http://docker/v1.44/info | jq .Runtimes
{
"crun": {
"path": "/usr/local/bin/crun",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"io.containerd.runc.v2": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runc": {
"path": "runc",
"status": {
"org.opencontainers.runtime-spec.features": "{\"ociVersionMin\":\"1.0.0\",...}"
}
},
"runsc": {
"path": "/usr/local/bin/runsc"
}
}
```
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-10-15 14:51:11 +00:00
// OCI runtime spec "features" struct.
//
// see https://github.com/opencontainers/runtime-spec/blob/main/features.md
const ociRuntimeFeaturesKey = "org.opencontainers.runtime-spec.features"
func ( daemon * Daemon ) runtimeStatus ( ctx context . Context , cfg * configStore , runtimeName string ) map [ string ] string {
m := make ( map [ string ] string )
if runtimeName == "" {
runtimeName = cfg . Runtimes . Default
}
if features := cfg . Runtimes . Features ( runtimeName ) ; features != nil {
if j , err := json . Marshal ( features ) ; err == nil {
m [ ociRuntimeFeaturesKey ] = string ( j )
} else {
log . G ( ctx ) . WithFields ( log . Fields { "error" : err , "runtime" : runtimeName } ) . Warn ( "Failed to call json.Marshal for the OCI features struct of runtime" )
}
}
return m
}