mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
The "backend" types in API were designed to decouple the API server implementation from the daemon, or other parts of the code that back the API server. This would allow the daemon to evolve (e.g. functionality moved to different subsystems) without that impacting the API server's implementation. Now that the API server is no longer part of the API package (module), there is no benefit to having it in the API module. The API server may evolve (and require changes in the backend), which has no direct relation with the API module (types, responses); the backend definition is, however, coupled to the API server implementation. It's worth noting that, while "technically" possible to use the API server package, and implement an alternative backend implementation, this has never been a prime objective. The backend definition was never considered "stable", and we don't expect external users to (attempt) to use it as such. This patch moves the backend types to the daemon/server package, so that they can evolve with the daemon and API server implementation without that impacting the API module (which we intend to be stable, following SemVer). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
28 lines
854 B
Go
28 lines
854 B
Go
package daemon
|
|
|
|
import (
|
|
containerpkg "github.com/docker/docker/daemon/container"
|
|
"github.com/docker/docker/daemon/server/backend"
|
|
"github.com/moby/moby/api/types/container"
|
|
)
|
|
|
|
// This sets platform-specific fields
|
|
func setPlatformSpecificContainerFields(container *containerpkg.Container, contJSONBase *container.ContainerJSONBase) *container.ContainerJSONBase {
|
|
contJSONBase.AppArmorProfile = container.AppArmorProfile
|
|
contJSONBase.ResolvConfPath = container.ResolvConfPath
|
|
contJSONBase.HostnamePath = container.HostnamePath
|
|
contJSONBase.HostsPath = container.HostsPath
|
|
|
|
return contJSONBase
|
|
}
|
|
|
|
func inspectExecProcessConfig(e *containerpkg.ExecConfig) *backend.ExecProcessConfig {
|
|
return &backend.ExecProcessConfig{
|
|
Tty: e.Tty,
|
|
Entrypoint: e.Entrypoint,
|
|
Arguments: e.Args,
|
|
Privileged: &e.Privileged,
|
|
User: e.User,
|
|
}
|
|
}
|